Re: Toolbar hiding on rotation?
Re: Toolbar hiding on rotation?
- Subject: Re: Toolbar hiding on rotation?
- From: Doug Hill <email@hidden>
- Date: Mon, 29 Aug 2016 10:21:45 -0700
> On Aug 29, 2016, at 9:57 AM, Alex Kac <email@hidden> wrote:
>
> I have a UINavigationController and UIViewController root that I set the toolbarItems on. I obviously also tell it not to hide the toolbar. Great! Works perfectly. But when I rotate, the toolbar is hidden - even if I rotate back to portrait. I've set all the "hides*" properties such as hidesBarsWhenVerticallyCompact to false (they were already false - but I tried anyway), and it still hides the toolbar. I’ve put breakpoints everywhere including symbolic ones for the toolbar hidden properties/methods in UIKit. Since we are using a navigationcontroller subclass, I even tried overriding the toolbar methods so that they can't get set to true (hiding that is) and it still hides the toolbar.
>
> In some ways, I'm okay with it hiding going in landscape, but I'm not OK with it not coming back when you go to portrait. The view debugger also shows the toolbar is completely gone. So something in UIKit is removing the toolbar view and never bringing it back - nothing I do can bring it back. This is obviously disconcerting. My next step will be to just creating my own toolbar instead of using Apple’s navcontroller toolbar, but if I can get it to work, that’s my preference.
>
> Any ideas?
It's interesting you mention this since I just spent a bunch of time trying to get this toolbar thing working according to Apple HIG.
For example, it used to say that on iPad you should put the bar button items in the Navigation Bar but on iPhone they should be at the bottom in a Toolbar. Now they say to use the Size classes to determine this. For example, regular width they put buttons in nav bar but in compact width use toolbar. This is because compact width generally corresponds to iPhone. But just to make things complicated multitasking windows on iPad are compact width. Further, landscape iPhone 6 plus (e.g. 5.5" display) is regular width. Gah! This is kind of weird because the toolbar hides and shows based on device rotation and multitasking modes, which seems a little jarring to me. But hey, go with the flow.
That said, I'm looking at my code and I see that I implement this logic in traitCollectionDidChange. And I'm just using self.navigationController.toolbarHidden for toolbar hiding and it seems to work fine. See if this property works for you, and let us know. Otherwise, there might be some other code hiding the toolbar.
Doug Hill
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden