ModalViewController触发太晚了

时间:2012-09-15 14:07:21

标签: objective-c modalviewcontroller

我正在打开一个通过XML加载更新的ModelViewController

在ViewController.m中

LoadUpdatesView *luv = [[LoadUpdatesView alloc]  initWithNibName:@"LoadUpdatesView" bundle:nil];
luv.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:luv animated:YES];

在LoadUpdatesView.m

- (void)viewDidLoad {
  [self xmlloadUpdates];
}

xmlloadUpdates

- (void) xmlloadUpdates {

   statusmessage.text = @"Start loading Updates"; 
    NSString * path = @"xxx.xml";
    [self parseXMLFileAtURL:path];

    for(int iX = 0; iX < [stories count]; iX++) {   
        statusmessage.text = @"Loading %@ of %@ entries",iX,[stories count];
    }

}

但是,模态窗口仅在xmlloadUpdates通过xml加载更新后显示。但是我想首先显示模态窗口,然后开始执行XML工作(xmlloadupdates在模态窗口上显示状态消息)

1 个答案:

答案 0 :(得分:1)