Why does addSubview load the view asynchronously

Posted by moshe on Stack Overflow See other posts from Stack Overflow or by moshe
Published on 2010-05-13T13:14:23Z Indexed on 2010/05/14 4:14 UTC
Read the original article Hit count: 286

Filed under:
|
|

I have a UIView that I want to load when the user clicks a button. There happens to be some data processing that happens as well after I call addSubview that involves parsing an XML file retrieved from the web. The problem is the view doesn't show up until after the data processing even if addSuview is called first. I think I'm missing something here, can anyone help?

Code: I have a "Loading..." view I'm adding as a custom modal (meaning I'm not using the modalViewController). This action is linked to a button in the navigationController.

- (IBAction)parseXml:(id)sender {
      LoadingModalViewController *loadingModal = [[LoadingModalViewController alloc] initWithNibName:@"LoadingModalViewController" bundle:nil];
      [navigationController.view addSubview:loadingModal.view];
      [xmlParser parse];
}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa