iPad Bug using storyboard with uipageviewcontroller and navigation controller - swift

I have a bug in my code that I hope some can help me with.
I have a UIPageViewController in my storyboard and I am also using a UINavigation Controller. When my segue is run which connects one view to switch to the uipageview the viewdidload method gets called on the uipageviewcontroller twice.
Weird thing is it only happens on the iPad the same code on the iPhone only gets called once. Does anyone know why that would happen?

Seems to have been a bug in iOS. When I updated my OS the problem was fixed.

Related

Xcode 14 UINavigationBar issue

After updating Xcode I see the message in console:
[Assert] UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems.
And all the data I have in the Navigation Controller scenes are not displays.
I tried to place this to the SceneDelegate, but it wasn't helpful:
self.window?.rootViewController = navigationVC
self.window?.makeKeyAndVisible()
What should I do to fix this?
I'm working on this bug too. I will update here if there is any progress. I'm also facing another exception:
_UINavigationBarContentViewLayout valueForUndefinedKey:
this class is not key value coding-compliant for the key inlineTitleView.
It should be a bug in iOS 16, not related to the Xcode version.
There are many others who have also encountered this problem: https://developer.apple.com/forums/thread/714278
A temporary solution is to use code rather than storyboards to create the navigation controller.
I also find that problem.
How I fix it
If you use storyboards.
Take the arrow( in Attribute inspector-> is initial view controller) from Navigation View Controller in the storyboard and put it in your next View Controller.
Simplify change, initial view controller, in storyboard
Restart Your Mac
And remove unnecessary functions on main class

XCODE 5 - Storyboard Segues Push vs Modal

I am currently learning iOS development and I began with a simple Tabbed Application. It has the default First and Second View in it. I added a TableView with static cells content. I then added another View Controller. I created a Segue using the storyboard. When I set the transition to modal, it works fine. When I set it to push, the app is crashing (Uncaught exception).
Any idea why?
How can I get more information regarding the exception? Can I make the app stops when it encounters an exception?
Figured it out.. I need to add a Navigation Controller to use push...

popViewController / viewWillAppear not animated in iOS 5

I wasn't lucky with searching for this, so here we go ;)
I have a UIViewController with a custom UINavigationBar which pushes another UIViewController as subview.
Everything works fine except when I click the back button on the subview. The previews (first) view appears correctly, but not animated. The animation of the UINavigationBar is correct, only the views switch immediately.
The function - (void)viewWillAppear:(BOOL)animated of the first UIViewController gets called with NO for animated. This only happens when I test with iOS 5, not with iOS 4.
Does anyone know how to fix this?
Thanks for your help! Hannes
UPDATE 1
I just removed all custom code and just used the plain UINavigationBar (so no extra settings) and it still doesn't work with iOS 5. This is my code I use in the first ViewController to push the second ViewController:
[self.navigationController pushViewController:secondViewController animated:YES];
As I already mentioned - when I click the back button in the navigation bar on the second view the first view appears immediately without animation.
Any help would be appreciated! Thanks!
UPDATE 2
I feel like I'm getting closer to the issue, but still no solution:
I just added a custom UINavigationController where I just call [super popViewControllerAnimated:animated]. This get's called correctly (animated is YES) but the viewWillAppear of the first UIViewController gets NO as value for animated...
I was having a similar problem today where the UIViewController was getting NO in viewWillAppear, except with the standard UINavigationBar and UINavigationController.
It turned out to be due to manually calling viewWillAppear:YES somewhere it shouldn't have been. This item suggests that it can also be caused by calling the wrong super method somewhere (e.g. [super viewWillAppear:animated] instead of [super viewDidAppear:animated] inside of viewDidAppear).
As for using a custom UINavigationBar, I ran across this link today that may help your case: http://sloshire1.posterous.com/simple-fix-for-viewwillappear-in-ios5
Apple implemented official ways to create custom navigation bars in iOS 5. Unfortunately, they also broke most of the non-official ways of doing it in iOS 4. iOS 5 won't call drawRect for you anymore. You need to have two ways of doing it, one for iOS 5 and greater, using the new calls, and one for iOS 4 and earlier, using the old calls. Check out the documentation for custom navigation bars in iOS 5 for more info.
Did you try to remove all your custom code and go with the native navigation bar? Does the behavior stay the same? This way you can check if your custom bar messes with the transition.

iPad : two-stage method implementation

here is my problem, I hope someone can help me.
My iPad app is made like this : I have several viewControllers added as tabs in a tabBarController added to window in my appDelegate. In each of these viewControllers I got two navigationControllers with one viewController in.
Appdelegate
TabBarController
viewController
navigationController
viewController
navigationController
viewController
viewController
navigationController
viewController
navigationController
viewController
Everything work fine in simulator but when I run it on device I got this warning :
Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations.
It only happen when I run it on a device in landscape mode. The first navigationController of the default view shown by the tabBarController take all the screen width (not important here but it's to explain that this warning makes my layout going crazy). In portrait nothing is traced in the console.
I read many things about this message but I can't find any solution to make it go away.
I'm sure it's a story of shouldAutoRotate or something like this.
I also notice that if i remove the tabBarController and simply add my first viewController to window, the message is not shown.
Very strange... please help :)
I think you should rely on the standard UISplitViewController available under iPad. This controller is what is used under the Settings app and various other apps.
If you do not feel comfortable with such a tool, you can take a look at the APSplitViewController plugin developed by slatvick on GitHub. This could solve a lot of your problems, I hope.
Edit
Googling about this issue, I found out that this warning appears when you create a wrong hierarchy of view controllers. In this case, you are pushing two navigation controllers inside a view controller, even if a view controller is not meant to contain different navigation controller. Probably there could be a problem related on how you send up to the parent view controller methods like viewDidLoad or viewWillLoad: etc. You should try to understand if you are passing all these call correctly to the parent view controller from the inner navigation controllers.

ipad: UINavigationController Inside a ModalView not pushing views

I have a UINavigationController with a UIViewcontroller containing a tableview that is being presented as a UIModalPresentationFormSheet on the ipad. Which works fine until I try to push another view on top of it. Nothing happens anyone else have this issue?
It also works perfectly on the iphone. and the didselectrowatindexpath is not a branched method.
Nick
I wish I knew what I did but I somehow fixed this, all I can say is that it is possible.