2

我在 ios 4.3 上构建了一个应用程序,它运行良好,但是当我在新的 ios 上运行它时,后退按钮不起作用。这是我转到下一个 xib 的代码:

-(IBAction)Selection3Page:(id)sender;{ //show next view Selection3Page * nvc = [[Selection3Page alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:nvc animated:NO]; [nvc release]; }

这是返回第一个 xib 的代码:

-(IBAction)done:(id)sender{
[self.parentViewController dismissModalViewControllerAnimated:NO];

}

请帮忙!!

4

2 回答 2

4

在 iOS 5 中,用于关闭模式视图的 API 有所改变。试试这个:

if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)])
{
    NSLog(@"didTouchDoneButton 5.x");
    [self dismissViewControllerAnimated:YES completion:nil];
}
else
{
    NSLog(@"didTouchDoneButton 4.x");
    [self dismissModalViewControllerAnimated:YES];
}
于 2011-10-20T01:27:57.860 回答
-1

post some NSLogs in there somewhere and check if the methods are actually getting called... I would start around that..

于 2011-10-16T16:02:46.513 回答