开发者

dismissModalViewControllerAnimated function not dismissing the view

I am trying to use dismissModalViewController:Animated: to dismiss my view, but it is not dismissing it, no matter what I try. You can see my attempts to release the view in the hideSplash method at the bottom. Please, if anyone can help it would be greatly appreciated. My code posted below:

#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];
    [activityIndi开发者_如何学Gocator 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


The modal view controller is not responsible for dismissal. That burden is placed on the view controller that called the modalViewController.

Try replacing:

[[self modalviewController] dismissModalViewControllerAnimated:YES];

with

[self dismissModalViewControllerAnimated:YES];


Try to use this:

[self.parentViewController dismissModalViewControllerAnimated:NO];


I found the solution in case anyone else has this issue the line

[self performSelector:@selector(hideSplash) withObject:nil];

Should be

[self performSelector:@selector(hideSplash) withObject:nil afterDelay:0.0];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜