I'm working on an iPhone app and have the strangest issue.
On iOS 6, buttons on the navigation bar are completely ignoring taps in the top half. Have a look at the image below, I have roughly selected tap areas of my navbar buttons:
https://www.dropbox.com/s/izs6ic5jlubm1yk/navtap_problem.png
Here's some, potentially useful, information:
the app supports iOS 6 and 7
the app is not using autolayout (working with deltas instead)
this issue is present only on iOS 6, it's working fine on iOS 7
the issue is present in all views across the app (that have a navigation bar on top)
the issue present in both navigation bars that are manually added in IB as well as in navigation bars that are coming from the UINavigationController
the problem is not present if I directly start the app from one of affected view controllers
the problem is present when I start the app through my empty InitialViewController and load another VC
I'm using ECSlidingViewController and loading the real VC (that users will see) from the InitialViewController like this:
self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"SearchSplitViewNavigationController"];
[self resetTopView];
It looks like something invisible is covering the top half of the navigation screen. I checked the contents of self.view.subviews, but didn't see anything there.
Any ideas what might be causing this? Or what else could I check?
If you are including any element programmatically, then that element isn't using the deltas you are including through the storyboard.
For these elements you must test for the iOS version you're in and adjust the delta in code.
Check this: Best Way to check for iOS 7 or earlier? for help on the version checking.
I've found a solution (not the cause though). This awesome library helped me a lot to identify the problem.
There was actually a transparent UIView sitting on top of my navigation bars. It was located at 0,20 and had a height of 20 points.
That view is not in the self.view.subviews array, but doing [self.view bringSubviewToFront:myNavigationBar] seems to do the trick...
Related
I'm developing an iOS 10 app using NavigationController and Storyboards. I'm having a difficult time to figure out whats going on with a strange - as I'm calling it - bug:
When I navigate to a new ViewController, it show's nicely, but when the app unwind a segue, the top view controller doesn't go all the way to the right, instead, it left's about 50 points on screen, and then suddenly it goes away...
I'm putting a image that illustrates what I'm talking about...
PS: both ViewControllers uses UIImageView as background...
Thanks a lot!
Please share the code where you are setting the fame for the view(s). It could possibly be an offset that is being added. Though, you do mention that it does go away suddenly, so it could be something else.
I followed this tutorial to create a PageViewController and it works perfectly when I run it on an iOS 9.3 emulator device. However, when I run it on an iOS 10.0 emulator device, it duplicates the first view controller behind the pageViewController - so that when you scroll left on the first slide, you can see the initial viewController peeking out from behind it, and similarly when you scroll right on the last viewController, you can see that same first viewController peek out from behind that too. On the iOS 9.3 device, there is just a white background.
Additional information:
I'm using the UIPageViewControllerTransitionStyleScroll so there is that 'bounce' effect (which is where you can see the white on iOS 9.3 and the duplicated viewController on iOS 10)
I cannot use another transition style (as some other solutions suggest just using a 'curl' transition)
I've already tried UIPageViewController memory leak (see solution by specialvict in that post)
Just to be clear, I want a white background behind the pageViewController so that when you scroll left on the first slide or right on the last one, you see just white.
Found the solution. The function used to create and setup the viewController and its subviews were standard and had nothing significantly different to the code from the tutorial above. The problem I had was that I called this function in viewDidLayoutSubviews without checking if the containerView was not perhaps already initialised (containerView being the view that I add the pageController to).
To check out what is happening, I print a short message to the log when the containerView is initialised. I removed the check if (!self.containerView) and iOS 9 only initialises the containerView once whilst iOS 10 initialises twice. Thus, adding the check if (!self.containerView) before initialising the containerView fixes this problem for 10.
I have an application that has 6 buttons in the navigation bar. Selecting one of the buttons cause a UIPopoverController to display. The problem is that our QE are saying that when selecting one button after the other it takes too much time for the popover to appear at the next button. Our sequence was to dismiss the current popover and create a new popover. We decided it would be faster just re-use the current UIPopoverController and call setContentViewController followed by presentPopoverFromRect with new rect and view. This seems to work fine for iOS 7. But in iOS 8 it never changes it position and after to two buttons crashes with [UIPopoverController setContentViewController:animated:] can only be called after the popover has been presented. Apparently, iOS 8 doesn't think the popover is visible anymore. Does anyone have a workaround to this issue for iOS 8 other than doing what we were initially doing? Thanks for any help.
We decided it would be faster just re-use the current UIPopoverController and call setContentViewController followed by presentPopoverFromRect with new rect and view.
You can change content of already presented popover, but you are trying to change then present. So you should first present it, then call setContentViewController (animated or not) when you are sure that popover is visible/presented/loaded.
After upgrading my project to iOS7
when I do a BACK Button and the UINavigationController goes back to the previous page, an ImageView on the top of the screen shifts down.
I use IB to do my layouts. These are my Simulated Metrics:
I have AutoLayout off. Any ideas on what the issue might be? I wasnt sure if anyone wants to see specific code and I didnt want to clutter up the question with too much code.
Updates: Based on the comment questions, I wanted to make these updates:
In no place in the application .h or .m file do I make any changes to the imageview's sizes or location.
In both the viewDidLoad and viewDidAppear I call a user-defined method called recalculateAll but their is no reference at all to any imageview sizes. Just for trying it out I commented out the entire section and ran the code and it still jumps down.
In my init I do programatically set some imageviews (you see the #132 in what appears to be a bubble) using their x and y's.
Here is a typical navigation I use for moving from the view controller to the tableviewcontroller:
GetTimeOffByType *showTimeOffReport = [[GetTimeOffByType alloc] initWithNibName:#"GetTimeOffByType" bundle:nil];
showTimeOffReport.timeOffType = #"Vacation";
[self.navigationController pushViewController:showTimeOffReport animated:YES];
These are all .xib files, no storyboarding at all. Its basically a view controller which has an embedded UINavigationController with 6 buttons. Each time a button is pressed it pushes a UITableViewController passing different parameters and showing different data. The transition I am using to get back to the original UIViewController is simply the iOS generated BACK button (so no code to show for that)
Update#2 Hopefully this will help someone solve this wierd behavior. So if I were to click on the table view cell on showTimeOffReport to get the cell detail and then using BACK navigate all the way back it doesnt jump down.
Update#3 Ok this is something I just discovered : The issue of jumping down or not is related to the translucency of the UINavigationBar. If you have a Translucent = YES it will start from the top of the window. If you have a translucent = NO it will start from the bottom of the UINavigationBar.
You might try setting the new property on UIViewController edgesForExtendedLayout to UIRectEdgeNone.
Here is a good resource that explains more about how view layouts changed in iOS 7.
See Apple Documentation
If you plan to be backwards compatible you will probably need to do some runtime checks and adjust positioning if the device is not running iOS 7.
This might help you..You can try adding UIViewControllerBasedStatusBarAppearance key and set it's value NO in your info.plist
UIViewControllerBasedStatusBarAppearance = NO
After building my iPad app against iOS 6.0 SDK, I get this weird behavior with my UISplitViewController's detailed view. The detailed view is positioned 20 pixels (points / 40 pixels) lower than it should be.
Here is what it looked like under 5.1:
For DetailViewController_iPad.xib in Interface Builder I've set the Simulated Metrics > Top Bar to None. This didn't help.
I've logged the view frame:
- (void) viewDidLayoutSubviews {
//.. etc
NSLog(#"viewDidLayoutSubviews: %#", CGRectCreateDictionaryRepresentation(self.view.frame) );
}
This logs the height as 684 instead of the what it should be: 704.
Height = 684; Width = 703; X = 0; Y = 0;
Anyone have any experience with this sort of thing? What should I try next?
UPDATE: This problem seems intermittent, with some compiles causing it, and some not.
If anyone else has had this problem and found out what causes it, I'd still be keen to know.
I had the exact same issue!
The issue will occur when there is another view controller in the navigation controller and this split view controller is pushed in the method application:didFinishLaunchingWithOptions: during app launch.
This fixed the problem for me:
When pushing the splitViewController I used
dispatch_async(dispatch_get_main_queue(), ^{
[self.navigationController pushViewController:splitViewController animated:NO];
})
instead of
[self.navigationController pushViewController:splitViewController animated:NO];
I used this only for iOS6 otherwise first view will be momentarily showed in OS < iOS6.
I'm assuming you're not doing anything to effect the frame of the view in code, correct? It's the view's controller that's doing all the layout? If so, have you tried tinkering with -wantsFullScreenLayout?
When a view controller presents its view, it normally shrinks that view so that its frame does not overlap the device’s status bar. Setting this property to YES causes the view controller to size its view so that it fills the entire screen, including the area under the status bar. (Of course, for this to happen, the window hosting the view controller must itself be sized to fill the entire screen, including the area underneath the status bar.) You would typically set this property to YES in cases where you have a translucent status bar and want your view’s content to be visible behind that view.
If this property is YES, the view is not resized in a way that would cause it to underlap a tab bar but is resized to underlap translucent toolbars. Regardless of the value of this property, navigation controllers always allow views to underlap translucent navigation bars.
The default value of this property is NO, which causes the view to be laid out so it does not underlap the status bar.
Mind you, -wantsFullScreenLayout should really only effect a window's root view controller. So if this fixes your problem (and you're not doing anything goofy with your view controller hierarchy), please file a bug with Apple!
Maybe [UIViewController statusBarHidden] is set to NO on your detail controller?
Xcode 4.5 has a habit of applying autolayout, which may be the cause of some of your grief - inspect this and trying deselecting it.
have you set autosizng property of height in xib file or programmatically, if yes try removing them and see if it helps the problem.
May help.
I was also affected with same issue i had just reduce size of view in my example:
I have 480px height in XIB for iPhone Apps and i reduce it to 460px.
Please same do for iPad not sure but may help.
I got the same problem when i tried to present another viewcontroller in ViewWillAppear method. I got it solved by moving my presentViewController code to ViewDidAppear method. Hope it will help.