Re: UINavigationController in Popover
Re: UINavigationController in Popover
- Subject: Re: UINavigationController in Popover
- From: Gordon Apple <email@hidden>
- Date: Mon, 14 Feb 2011 14:35:29 -0600
- Thread-topic: UINavigationController in Popover
Good timing. I just added a navigation controller to another popover last
night and am getting similar results. Even though I am using the same size
for both the views, the nav controller still tries to shape the view into
that of a standard table view, i.e., long and narrow. I used the same
delayed invocation to set it properly, but it still does that annoying
bounce towards long, then correct size.
I'll try your delegate approach and see if it works better. Thanks.
On 2/14/11 2:23 PM, "Matt Neuburg" <email@hidden> wrote:
> Sorry it's taken me a while to get to this. I ran my own tests and what I see
> is buggy (i.e. not what the docs would seem to advertise) but not identical to
> what you describe.
>
> Assuming the UINavigationController does nothing about setting its own size,
> and that (as I suggested) each contained view controller's
> contentSizeForViewinPopover is set, what I see is that when a view is pushed
> or popped on the UINavigationController, the popover does animated correctly
> in terms of width, but its height only changes if the new height is *larger*
> than the current height - the height will never get *smaller*.
>
> So for example if the root view controller's stated size is 320,400 and the
> secondary view controller's stated size is 400,600, the popover appears the
> correct size at the outset and then animates to the correct size when the
> secondary view controller is pushed; but when the secondary view controller is
> popped, the popover changes width but not height.
>
> Thus it does seem like a good idea to keep all contained views the same
> height. I really don't like the look of the resulting width animation, either,
> so maybe it's best if they really are all the same size!
>
> I was able to work around the problem, though, without the use of delayed
> performance, by implementing the nav controller's delegate method:
>
> - (void)navigationController:(UINavigationController *)navigationController
> didShowViewController:(UIViewController *)viewController
> animated:(BOOL)animated {
> navigationController.contentSizeForViewInPopover =
> viewController.contentSizeForViewInPopover;
> }
>
> To be sure, I'm just doing here what I would have expected the nav controller
> to do for me, but at least it works.
>
> m.
>
> On Dec 18, 2010, at 12:24 PM, Gordon Apple wrote:
>
>> I've tried a variety of means to fix this, but the animations seem to
>> collide and the nav controller wins. Thus the delayed invocation in
>> resetting the size to where it should be. I notice that Apple's Pages app
>> simply keeps the popover size the same for all panels, so it avoids the
>> problem.
>>
>>
>> On 12/17/10 10:49 AM, "Matt Neuburg" <email@hidden> wrote:
>>
>>> On Thu, 16 Dec 2010 14:37:00 -0600, Gordon Apple <email@hidden> said:
>>>> I've Googled this and have seen that others have had this problem, but no
>>>> good solutions. When using a UINavigationController in a popover, where
>>>> the
>>>> content can be different sizes, the nav controller seems to always wants to
>>>> make the popover full screen height, ignoring popover size settings. The
>>>> only way I've found to defeat it is to reset the popover size with a 0.5
>>>> sec
>>>> delayed invocation. It works, but it's ugly. It expands, then contracts
>>>> to
>>>> the set size. Is there any better way to do this? (I'm still on 3.2
>>>> because I want to make sure it works there.)
>>>
>>> My experience is that if your navigation controller's root view controller
>>> supplies its own popover size in contentSizeForViewInPopover, the navigation
>>> controller does exactly the right thing - it expands that size to allow for
>>> its own nav bar, and passes this on up to the popover controller, which
>>> sizes
>>> the popover correctly. (If you're not seeing that, it may be because you're
>>> testing under 3.2; I have no idea.) m.
>
> --
> matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
> pantes anthropoi tou eidenai oregontai phusei
> Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
> AppleScript: the Definitive Guide, 2nd edition
> http://www.tidbits.com/matt/default.html#applescriptthings
> Take Control of Exploring & Customizing Snow Leopard
> http://tinyurl.com/kufyy8
> RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
> TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
>
>
_______________________________________________
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