gpt4 book ai didi

ios - dismissModalViewControllerAnimated 函数不关闭 View

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:53:51 24 4
gpt4 key购买 nike

我正在尝试使用 dismissModalViewController:Animated: 关闭我的 View ,但无论我尝试什么,它都没有关闭它。您可以在底部的 hideSplash 方法中看到我试图释放 View 。请,如果有人可以提供帮助,将不胜感激。我的代码贴在下面:

#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

最佳答案

模态视图 Controller 不负责解雇。这个负担放在了调用 modalViewController 的 View Controller 上。

尝试替换:

[[self modalviewController] dismissModalViewControllerAnimated:YES];

[self dismissModalViewControllerAnimated:YES];

关于ios - dismissModalViewControllerAnimated 函数不关闭 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2107065/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com