Re: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.
Re: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.
- Subject: Re: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.
- From: Brian Bruinewoud <email@hidden>
- Date: Sun, 9 Aug 2009 15:40:59 +1000
Thanks for the replies so far.
Lazy loading makes sense.
But what you say bellow suggests that the code in my original post is
broken - or at least, potentially broken.
The design comes from a beta version "iPhone SDK Development" by Bill
Dudney and Chris Adamson.
They use something very similar every time they load a new view in
response to user action, such a responding to
tableView:didSelectRowAtIndexPath: where they need to tell the new
view what instance it's meant to display. As such, it's a method of
passing arguments down to the new view. This can't really be done in
viewDidLoad because that's in the new view, not the 'calling' view.
Is the way they are doing it incorrect? Ill advised or not just not as
good as it could be? What would be the better way to achieve this?
At a guess to my second question: I suppose the new view should call
on methods/properties of its File's Owner to discover what it needs to
display. I haven't tried this so I don't know if its a workable
solution, but it seems like it could be.
Thanks,
Brian.
On 08/08/2009, at 23:35 , Luke the Hiesterman wrote:
On Aug 8, 2009, at 1:23 AM, Brian Bruinewoud wrote:
Why doesn't initWithNibName create and bind all the IBOutlets
before it returns?
Is the view guaranteed to be visible after pushViewController
returns?
Or is it still animating on another thread?
Or is the request to display the view merely queued for the next
loop through the RunLoop?
Kyle already answered the question about lazy nib loading. I'll
answer the others by saying no, you shouldn't expect the view to be
displayed after calling pushViewController. I KNOW that it's not
displayed immediately if you call pushViewController:animated:YES. I
don't recall off the top of my head if it will display immediately
with animated:NO, but you definitely should not rely on that either
way.
You should be overriding methods from UIViewController to accomplish
the kind of setup you're talking about. It sounds like viewDidLoad
is probably what you want. If you override this method, it will give
you an opportunity to setup properties after the view controller's
view has loaded. Alternatively, there is viewWillAppear: and
viewDidAppear: that let you do things right around the actual
display of the view.
Luke
_______________________________________________
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