Brion VIBBER has uploaded a new change for review. https://gerrit.wikimedia.org/r/88169
Change subject: Made text box not underlap nav bar when keyboard appears. ...................................................................... Made text box not underlap nav bar when keyboard appears. Needed based on previous commit which leaves nav bar in place when details is scrolled to top. Change-Id: I10fd0e6e16a925bd1bef8c24d0dd9dafce1aa419 --- M Commons-iOS/DetailScrollViewController.m M Commons-iOS/ImageScrollViewController.m 2 files changed, 6 insertions(+), 46 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/ios/commons refs/changes/69/88169/1 diff --git a/Commons-iOS/DetailScrollViewController.m b/Commons-iOS/DetailScrollViewController.m index 8af7afb..9e3b7f0 100644 --- a/Commons-iOS/DetailScrollViewController.m +++ b/Commons-iOS/DetailScrollViewController.m @@ -298,12 +298,6 @@ if(!self.selectedRecord.complete.boolValue){ [self addNavBarBackgroundViewForTouchDetection]; } - - // Ensure nav bar isn't being underlapped by details - // (needed if details pushed another view controller while details was scrolled so far up that - // it had caused the nav bar to be hidden - without this extra call to "makeNavBarRunAwayFromDetails" - // here, when that pushed view gets popped, the nav would overlap the details) - //[self makeNavBarRunAwayFromDetails]; } -(void)viewDidAppear:(BOOL)animated @@ -328,7 +322,6 @@ [super viewWillDisappear:animated]; // Ensure the nav bar is visible - // (needed because "makeNavBarRunAwayFromDetails" method could have hidden the nav bar) [self.navigationController setNavigationBarHidden:NO animated:NO]; } @@ -774,34 +767,9 @@ self.delegate.navigationItem.prompt = nil; } --(void)makeNavBarRunAwayFromDetails -{ - // Calling "setNavigationBarHidden:" below causes subviews to be laid out. If the view was being - // dragged when this method is called this will cause the layout system to use the last value it - // had for self.viewTopConstraint.constant, which, during drag, doesn't get updated until the drag - // ends, so the pre-drag value is seen and the layout system makes self.view jump down to this - // position, which is not what we want at all. To prevent this, update self.viewTopConstraint.constant - // here. See the note in "handleDetailsPan:" concerning updating "self.viewTopConstraint.constant" - // for more details about the issue. (To reproduce the bug, use iOS 7, comment out the line below and - // drag the details page slider up until the top of it hits the navigation bar.) - self.viewTopConstraint.constant = self.view.frame.origin.y; - - // Prevent details from underlapping nav bar by hiding nav bar when details scrolled up so - // far that underlap would occur. And when details scrolled back down make nav bar re-appear. - if ([self verticalDistanceFromNavBar] < 0.0f) { - if (!self.navigationController.navigationBarHidden) { - [self.navigationController setNavigationBarHidden:YES animated:YES]; - } - }else{ - if (self.navigationController.navigationBarHidden) { - [self.navigationController setNavigationBarHidden:NO animated:YES]; - } - } -} - -(float)verticalDistanceFromNavBar { - return self.view.frame.origin.y - self.navigationController.navigationBar.frame.size.height; + return self.view.frame.origin.y - (self.navigationController.navigationBar.frame.size.height + self.navigationController.navigationBar.frame.origin.y); } @@ -1593,20 +1561,14 @@ // position actively around the keyboard as it moves, other than to just slide // things up a bit when it first appears - float statusBarOffset = [view.superview convertPoint:view.frame.origin toView:self.delegate.view].y; - - // If not iPad return offset for scrolling view beneath the status bar. - // If iPad shift everything down a bit from there. - float offsetForKeyboard = statusBarOffset - ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? 150.0f : 0.0f); - - return -offsetForKeyboard; + return -(self.view.frame.origin.y - self.navigationController.navigationBar.frame.size.height + [view.superview convertPoint:view.frame.origin toView:self.view].y - self.navigationController.navigationBar.frame.origin.y); } #pragma mark - Details distances -(float)getBottomGapHeight { - return self.delegate.view.bounds.size.height - (self.view.frame.origin.y + self.scrollContainer.frame.size.height);; + return self.delegate.view.bounds.size.height - (self.view.frame.origin.y + self.scrollContainer.frame.size.height); } -(float)tableTopVerticalDistanceFromDelegateViewBottom diff --git a/Commons-iOS/ImageScrollViewController.m b/Commons-iOS/ImageScrollViewController.m index 6ee2775..974207c 100644 --- a/Commons-iOS/ImageScrollViewController.m +++ b/Commons-iOS/ImageScrollViewController.m @@ -108,11 +108,9 @@ { [super viewDidLoad]; - // "wantsFullScreenLayout = NO" makes self.view not underlap the status bar on iOS 6. - // Really matters when pinch has expanded image and the image is dragged downward. The top - // of the image will drag (actually when drag is released) to the bottom of the status bar - // if this is NO, and to top of it if YES. - self.wantsFullScreenLayout = NO; + // For iOS 6 so it considers the absolute top left of the screen to be 0,0 - otherwise just below the + // title bar is 0,0 + self.wantsFullScreenLayout = YES; // Change back button to be an arrow self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[[CommonsApp singleton] getBackButtonString] -- To view, visit https://gerrit.wikimedia.org/r/88169 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I10fd0e6e16a925bd1bef8c24d0dd9dafce1aa419 Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/commons Gerrit-Branch: master Gerrit-Owner: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: Mhurd <mh...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits