{"action":"created","issue":{"url":"https://api.github.com/repos/jaredsinclair/JTSImageViewController/issues/53","labels_url":"https://api.github.com/repos/jaredsinclair/JTSImageViewController/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/jaredsinclair/JTSImageViewController/issues/53/comments","events_url":"https://api.github.com/repos/jaredsinclair/JTSImageViewController/issues/53/events","html_url":"https://github.com/jaredsinclair/JTSImageViewController/issues/53","id":58491170,"number":53,"title":"iOS 8 contentOffset","user":{"login":"Shayanzadeh","id":1910721,"avatar_url":"https://avatars.githubusercontent.com/u/1910721?v=3","gravatar_id":"","url":"https://api.github.com/users/Shayanzadeh","html_url":"https://github.com/Shayanzadeh","followers_url":"https://api.github.com/users/Shayanzadeh/followers","following_url":"https://api.github.com/users/Shayanzadeh/following{/other_user}","gists_url":"https://api.github.com/users/Shayanzadeh/gists{/gist_id}","starred_url":"https://api.github.com/users/Shayanzadeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shayanzadeh/subscriptions","organizations_url":"https://api.github.com/users/Shayanzadeh/orgs","repos_url":"https://api.github.com/users/Shayanzadeh/repos","events_url":"https://api.github.com/users/Shayanzadeh/events{/privacy}","received_events_url":"https://api.github.com/users/Shayanzadeh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-22T05:26:17Z","updated_at":"2015-02-22T15:20:11Z","closed_at":null,"body":"Hi,\r\n\r\nFirst of all thank you for all the amazing work on this project.\r\n\r\nThe issue I have is very minuscule. In iOS 8 while using a UITableView, I present the JTSImageViewController and upon dismissal the table view scrolls (not animated) to the top, that is to say the contentOffset is lost.\r\n\r\nI read through most of the code in JTSImageViewController.m and it is not at fault. Apparently it's the default behaviour to reset the contentOffset after returning from a modal view controller. I have tried `automaticallyAdjustsScrollViewInsets = NO` and using a UITableView inside a UIViewController instead of a UITableViewController but no luck. I've also tried setting the contentOffset back after the dismissal but it flashes.\r\n\r\nIt seems setting the modal presentation style of JTSImageViewController to UIModalPresentationOverFullScreen fixes the issue (since it doesn't remove the hierarchy below it and retains the scroll position I think). As this enum is new to iOS 8 I am going to assume that it's an iOS 8 only issue (since if it wasn't there would be more issues about it). \r\n\r\nAny thoughts? Has anyone else experienced this? If so should I make a pull request for this simple change?\r\n```objc\r\nif ([[[UIDevice currentDevice] systemVersion] compare:@\"8.0\" options:NSNumericSearch] != NSOrderedAscending) {\r\n    self.modalPresentationStyle = UIModalPresentationOverFullScreen;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/jaredsinclair/JTSImageViewController/issues/comments/75440019","html_url":"https://github.com/jaredsinclair/JTSImageViewController/issues/53#issuecomment-75440019","issue_url":"https://api.github.com/repos/jaredsinclair/JTSImageViewController/issues/53","id":75440019,"user":{"login":"Shayanzadeh","id":1910721,"avatar_url":"https://avatars.githubusercontent.com/u/1910721?v=3","gravatar_id":"","url":"https://api.github.com/users/Shayanzadeh","html_url":"https://github.com/Shayanzadeh","followers_url":"https://api.github.com/users/Shayanzadeh/followers","following_url":"https://api.github.com/users/Shayanzadeh/following{/other_user}","gists_url":"https://api.github.com/users/Shayanzadeh/gists{/gist_id}","starred_url":"https://api.github.com/users/Shayanzadeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shayanzadeh/subscriptions","organizations_url":"https://api.github.com/users/Shayanzadeh/orgs","repos_url":"https://api.github.com/users/Shayanzadeh/repos","events_url":"https://api.github.com/users/Shayanzadeh/events{/privacy}","received_events_url":"https://api.github.com/users/Shayanzadeh/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T15:20:11Z","updated_at":"2015-02-22T15:20:11Z","body":"Thanks for the response.\r\n\r\nI just tried that and looking at the call stack I don't see anything that could be causing it (that is in our control at least). Looks like most of it is just private internal methods that get called that trigger it. I Googled `_adjustContentOffsetIfNecessary` and this [tweet](https://twitter.com/steipete/status/219848151765483520) by Peter Steinberger suggests to make sure the main view isn't a scrollview and the first subview is a dummy view, as well as setting `automaticallyAdjustsScrollViewInsets = NO`, but I have tried both of those and it doesn't work.\r\n\r\nUnfortunately I have to finish this app in the next 3 days so I can't spend anymore time investigating, and my solution works in my case so I will just move on.\r\n\r\n```\r\n(lldb) bt\r\n* thread #1: tid = 0x413cb, 0x00000001867ecd00 UIKit`-[UIScrollView setContentOffset:], queue = 'com.apple.main-thread', stop reason = breakpoint 1.1\r\n  * frame #0: 0x00000001867ecd00 UIKit`-[UIScrollView setContentOffset:]\r\n    frame #1: 0x00000001868a2dd4 UIKit`-[UITableView setContentOffset:] + 300\r\n    frame #2: 0x0000000186aa7e40 UIKit`-[UIScrollView(UIScrollViewInternal) _adjustContentOffsetIfNecessary] + 864\r\n    frame #3: 0x00000001867e500c UIKit`-[UIScrollView setContentSize:] + 344\r\n    frame #4: 0x00000001868aa748 UIKit`-[UITableView _updateContentSize] + 540\r\n    frame #5: 0x00000001868b05f4 UIKit`-[UITableView didMoveToWindow] + 88\r\n    frame #6: 0x00000001867cd5f8 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 1464\r\n    frame #7: 0x00000001867eea34 UIKit`-[UIScrollView _didMoveFromWindow:toWindow:] + 68\r\n    frame #8: 0x00000001867cd310 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 720\r\n    frame #9: 0x00000001867cd310 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 720\r\n    frame #10: 0x00000001867cd310 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 720\r\n    frame #11: 0x00000001867cd310 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 720\r\n    frame #12: 0x00000001867cd310 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 720\r\n    frame #13: 0x00000001867cd310 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 720\r\n    frame #14: 0x00000001867cc9e0 UIKit`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 144\r\n    frame #15: 0x00000001867cc8c0 UIKit`-[UIView(Hierarchy) _postMovedFromSuperview:] + 484\r\n    frame #16: 0x00000001867d83a0 UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1764\r\n    frame #17: 0x0000000186805784 UIKit`+[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 508\r\n    frame #18: 0x000000018681d3d4 UIKit`+[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 68\r\n    frame #19: 0x00000001868c3744 UIKit`-[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 1140\r\n    frame #20: 0x0000000186ace738 UIKit`__56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 1836\r\n    frame #21: 0x0000000186853564 UIKit`_applyBlockToCFArrayCopiedToStack + 356\r\n    frame #22: 0x00000001867c4e78 UIKit`_afterCACommitHandler + 532\r\n    frame #23: 0x0000000181fdaa50 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32\r\n    frame #24: 0x0000000181fd79dc CoreFoundation`__CFRunLoopDoObservers + 360\r\n    frame #25: 0x0000000181fd7dbc CoreFoundation`__CFRunLoopRun + 836\r\n    frame #26: 0x0000000181f050a4 CoreFoundation`CFRunLoopRunSpecific + 396\r\n    frame #27: 0x000000018b09f5a4 GraphicsServices`GSEventRunModal + 168\r\n    frame #28: 0x0000000186836aa4 UIKit`UIApplicationMain + 1488\r\n    frame #29: 0x00000001000e3600 Jailbreak`main(argc=1, argv=0x000000016fd37a60) + 116 at main.m:14\r\n    frame #30: 0x0000000192ddaa08 libdyld.dylib`start + 4\r\n```"}}