我正在尝试使用dismissModalViewController:Animated:
来驳回我的观点,但无论我尝试什么,它都不会解雇它。您可以看到我尝试在底部的hideSplash
方法中发布视图。请,如果有人可以提供帮助,将不胜感激。我的代码发布在下面:
#import "SplashViewController.h"
@implementation SplashViewController
- (void) didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void) viewDidUnload {
}
- (void) dealloc {
[super dealloc];
}
-(void) showSplash {
modalViewController = [[UIViewController alloc] init];
modalViewController.view = modelView;
[self presentModalViewController:modalViewController animated:NO];
[activityIndicator startAnimating ];
//[self bigcalculation];
//[self performSelector:@selector(hideSplash) withObject:nil afterDelay:2.0];
}
- (void) viewDidAppear:(BOOL)animated {
NSLog(@"View Did Appear");
[self bigcalculation];
}
- (void) bigcalculation {
NSLog(@"Big Calc Start");
for (int i = 0; i <= 648230; i++) {
for (int j = 0; j <= 1200; j++) {
}
}
NSLog(@"Big Calc End");
[self performSelector:@selector(hideSplash) withObject:nil];
}
- (void) hideSplash {
NSLog(@"Hide");
//[self dismissModalViewControllerAnimated:NO];
//[[self parentViewController] dismissModalViewControllerAnimated:YES];
[[self modalViewController] dismissModalViewControllerAnimated:YES];
NSLog(@"End Hide");
}
@end
答案 0 :(得分:9)
模态视图控制器不负责解雇。这种负担放在调用modalViewController的视图控制器上。
尝试更换:
[[self modalviewController] dismissModalViewControllerAnimated:YES];
与
[self dismissModalViewControllerAnimated:YES];
答案 1 :(得分:2)
尝试使用它:
[self.parentViewController dismissModalViewControllerAnimated:NO];
答案 2 :(得分:1)
我找到了解决方案以防其他人遇到此问题的行
[self performSelector:@selector(hideSplash) withObject:nil];
应该是
[self performSelector:@selector(hideSplash) withObject:nil afterDelay:0.0];