On Thu, 03 Mar 2011 10:32:18 +0000, Martin Linklater <[email protected]>
said:
>Thanks for your replies guys - that makes a lot of sense now
Except that as Robert Vojta told you (and as Luke Hiesterman has clearly stated
on other occasions) it is wrong to assume that viewDidLoad means that the view
is now in the *interface*, or even that it is *about* to be put into the
interface, so it makes no sense to assume that an animation launched from
viewDidLoad, even with delayed performance, will be seen by the user. It might
appear to work, but it's still wrong. So this solution is incorrect:
>> On Mar 2, 2011, at 12:42 PM, Andreas Grosam wrote:
>>
>>> - (void) viewDidLoad {
>>> [super viewDidLoad];
>>>
>>> // Create the button:
>>> // ...
>>>
>>> [self performSelector:@selector(addButtonWithAnimation) withObject:nil
>>> afterDelay:0.0];
>>> }
The proper way to trigger an animation when the view first appears is in
viewDidAppear:, using a static variable or instance variable as a flag so that
this happens only the first time.
See Luke's dictum on the matter in this thread:
http://www.cocoabuilder.com/archive/cocoa/297736-why-can-a-modal-view-controller-present-another-in-viewdidload.html
Note that I suggested delayed performance in viewDidLoad and he slapped me
around for a while. :) So now I'm warning everyone else! :))
m.
--
matt neuburg, phd = [email protected], <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]