我很难尝试做一些简单的事情,
我有一个视图控制器,我想将它用作主菜单视图控制器的启动屏幕。我不明白为什么不从飞溅中调用模态。
有人知道发生了什么吗?
- (void)viewDidLoad
{
[super viewDidLoad];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
indicator.frame = CGRectMake(0.0, 0.0, 180.0, 180.0);
indicator.center = self.view.center;
[self.view addSubview:indicator];
[indicator bringSubviewToFront:self.view];
[UIApplication sharedApplication].networkActivityIndicatorVisible = TRUE;
//prepare all resources for app
[indicator startAnimating];
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
MainMenuViewController* mainMenu = [sb instantiateViewControllerWithIdentifier:@"mainMenu"];
mainMenu.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:mainMenu animated:YES];
}
如果我使用相同的代码附加一个按钮按下事件,它可以正常工作:
//[btn1 addTarget:self action:@selector(buttonPressedAction:) forControlEvents:UIControlEventTouchUpInside];
- (void)buttonPressedAction:(id)sender
{
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
MainMenuViewController* mainMenu = [sb instantiateViewControllerWithIdentifier:@"mainMenu"];
mainMenu.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:mainMenu animated:YES];
}