ios - UIActionSheet 未在 iOS 8 中显示

标签 ios ios7 ios8 uiactionsheet

我可以在 iOS 7 中显示 actionSheet,但不能在 iOS 8 环境中显示。有什么办法可以追溯吗?

  UIActionSheet *_actionSheet = [[UIActionSheet alloc] initWithTitle:@"Account"
                                                               delegate:self 
                                                      cancelButtonTitle:@"Close" 
                                                 destructiveButtonTitle:@"Log Out" 
                                                      otherButtonTitles:@"View Account", nil];

    [_actionSheet showInView:appDel.window];

最佳答案

UIActionSheet 在 iOS 8 中被弃用。

enter image description here

要在 iOS 8 中创建和管理操作表,您应该使用 UIAlertController 和 preferredStyle 的 UIAlertControllerStyleActionSheet。

引用这个example .

关于ios - UIActionSheet 未在 iOS 8 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26061964/

相关文章:

ios - respondsToSelector 在 UIButton 上为 "setTitle:"返回 YES 但没有这样的选择器

ios - UILabel 文本颜色不会以编程方式更改,如果我在 nib 中设置文本颜色并在 Assets 中定义该颜色

php - 正在所有浏览器和 iPhone 上上传文件,iPad 除外

ios - Metal makeComputeCommandEncoder 断言失败

iphone - 错误 : Message sent to deallocated instance

ios - 如何使用 iOS Simulator 7\XCode 5 测试 iOS 7 之前的用户界面(无需升级 iOS 7 的应用程序)

ios - 为什么呈现 Controller 的 view.transform 在解雇时被重置?

ios - iOS 7 中 Notes 应用程序的字体效果

objective-c - 如何在 iOS8 的 UIAlertController 中自定义 UIAlertAction?

ios8 - 从文件 URL 中检索 ALAsset 或 PHAsset