views:

66

answers:

1

I am openning a modal window with the iPad SDK.

[parent presentModalViewController:myPopup animated:YES];

The myPopup view has lots of building code in its viewDidLoad method and therefore there is a 3 or 4 section pause while myPopup's view is being built before the popup animation starts.

What I want to do is only build the basics of the myPopup view and then do all the coredata calls and construct the rest of the view only after the popup has animated onto the screen.

Can I put a selector or something on the presentModalViewContainer animation so I can call a method to do further building only after the animation is complete? I tried viewDidAppear and viewWillAppear and these are never called for a modal popup (I debugged) so nothing is built!

-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
[self buildView];

Thankyou very much.

A: 

Try putting your building code into -viewDidAppear: instead of did load.

The building should then take place after the view is animated on screen, however, the UI will still become blocked while your building code is running unless you move it off the main thread.

There are a number of options for doing this: threading, NSOperation, blocks, etc.

Jasarien
I tried this - see edited question :(
Mike Simmons
Thannks :). I used multi-threading via NSOperation. Followed this solution here:http://icodeblog.com/2010/03/04/iphone-coding-turbo-charging-your-apps-with-nsoperation/.
Mike Simmons