Re: Why can't a modal view controller present another in viewDidLoad?
Re: Why can't a modal view controller present another in viewDidLoad?
- Subject: Re: Why can't a modal view controller present another in viewDidLoad?
- From: Gustavo Pizano <email@hidden>
- Date: Sun, 16 Jan 2011 22:46:22 +0100
On Jan 16, 2011, at 8:47 PM, Luke Hiesterman wrote:
> viewDidLoad is called the first time the view property of the vc is accessed - that's when loading happens. There is no guarantee that the view is in a window at that time, and presenting a modal vc on a vc whose view is not in a window does not make sense. Perhaps viewDidAppear is what you were looking for. Where does the documentation say you can do this in viewDidLoad?
I think he meant that you can put 2 modal views one on top of each other, not that he can load them from the viewDidLoad method.
G.
>
> Luke
>
> Sent from my iPhone.
>
> On Jan 16, 2011, at 11:33 AM, G S <email@hidden> wrote:
>
>> Hi all.
>>
>> The Apple doc says this is possible, but it doesn't work when you want
>> the second modal view controller presented immediately. If you
>> present a modal view controller that immediately presents another one
>> in its viewDidLoad method, the second one never shows up. No errors
>> are reported, so what's going on?
>>
>> A workaround I've seen people use (which does work) is to have the
>> ultimate parent instantiate all of the children's modal views, but
>> that requires every parent to determine (in advance) every view
>> controller in the hierarchy; obviously that's poor practice. For
>> example, this works:
>>
>> [self presentModalViewController:newPictureController animated:NO];
>> [self.newPictureController
>> presentModalViewController:newPictureController.picker animated:YES];
>>
>> This makes it impossible to create controllers that manage their own
>> modal views upon instantiation. Should the failure to show a modal
>> view controller from viewDidLoad be regarded as a bug in the SDK?
>> Anybody have a solution?
>>
>> Thanks!
>>
>> Gavin
>> _______________________________________________
>>
>> 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
> _______________________________________________
>
> 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
_______________________________________________
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