按钮在 IOS5 中不起作用

标签 button view ios5 ibaction xcode4.2

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

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

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

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

}

请帮忙!!

最佳答案

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

关于按钮在 IOS5 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7785269/

相关文章:

java - Button2 正在做 Button1 应该做的事情

Angular 4 : Disable button in ngFor after click

jquery - 如何将数据表按钮与按钮组分开显示?

ios - 在 XIB iOS 之间移动

ruby - 如何将这个 Objective C 重写为 RubyMotion?

iOS 5 库/缓存清除回调

ios - 将 iOS 中的相机对焦模式设置为手动或微距

android - 仅按钮左侧的边框

wpf - 我应该为我的 View 使用 UserControls 而不是 DataTemplates 吗?

android - 将 Android View 从服务器发送到客户端