按钮在 IOS5 中不起作用

发布于 2024-12-10 08:29:32 字数 462 浏览 1 评论 0原文

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

-(IBAction)Selection3Page:(id)sender;{ //显示下一个视图 Selection3Page * nvc = [[Selection3Page alloc] initWithNibName:nil bundle:nil]; [自我呈现ModalViewController:nvc动画:否]; [NVC 发布]; }

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

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

}

请帮忙!

i built an app on ios 4.3 and it worked fine but when i run it on the new ios the back buttons dont work. Heres my code to go to the next xib:

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

and this is the code to return back to the first xib:

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

}

please help!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

莫多说 2024-12-17 08:29:32

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];
}

The API for dismissing modal views was changed somewhat in iOS 5. Try this instead:

if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)])
{
    NSLog(@"didTouchDoneButton 5.x");
    [self dismissViewControllerAnimated:YES completion:nil];
}
else
{
    NSLog(@"didTouchDoneButton 4.x");
    [self dismissModalViewControllerAnimated:YES];
}
绮筵 2024-12-17 08:29:32

在某处发布一些 NSLog 并检查这些方法是否实际上被调用......我会从那里开始......

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文