iOS8 setContentViewController crash - ios

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.

Related

iOS 10 - NavigationController, view not being hide completely on dismiss

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.

UIPageViewController duplicates first ViewController behind PageViewController for iOS 10 but behaves normally with a white background for iOS 9.3

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.

Top half of UINavigationBar on iOS6 not responding to taps

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...

IOS7: Pop ViewController forces the UIImageView to drop

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

iPad UISplitView initial state in portrait: how to display popover controller widget?

I'm working on an iPad app that uses a UISplitView. Inspired by http://blog.blackwhale.at/2010/04/your-first-ipad-split-view-application/, I display a button in my detail view when in portrait mode that shows the popover controller. This works great. However, the appropriate UISplitViewControllerDelegate message is only sent when the device rotates. So, when the app first loads (in portrait mode), my navigation button is not visible.
Is it possible to somehow convince the UISplitViewController to send that message on load or something, or do I need to re-implement my own popover logic to get things working?
Thanks,
-Patrick
We had the exact same issue and it turned out that this thread had the right clues. When comparing our app with the SplitView template, we noticed that the split template does exactly what was mentioned here: set the UISplitViewController as the root view controller in application:didFInishLaunchingWithOptions.
Out previous solution linked the split view controller in the XIB directly to the window. While this works it seems the split view has difficulties getting the startup orientation and the missing button occurs. When we removed the link in the XIB and created it in code in the app delegate, everything ran fine.
That's weird. Maybe you missed something. Take a look at the template based on a splitController. It works fine form very startup no matter in what mode the app was loaded.
did you make sure that your UISplitViewController's view is the only subview of your UIWindow, and that you added it inside the application:didFinishLaunchingWithOptions: method of your app delegate

Resources