Xcode 11 beta 3 上 UIAction 的语法
Syntax for UIAction on Xcode 11 beta 3
Xcode 11 beta 3 不再接受此代码实例化 UIAction
:
let action = UIAction(__title: "title", image: someImage, options: []) { _ in
// some action
}
documentation 也没有。
我发现 a post on Apple Developer Forums 描述了同样的问题和现在被接受的语法,但它会导致运行时错误:
let action = UIAction(__title: "title", image: someImage, identifier: nil, handler: { _ in
// some action
}
+[UIAction actionWithTitle:image:identifier:handler:]: unrecognized selector sent to class 0x7fffa1b30178
还有这个新参数 identifier
,但我找不到任何关于如何使用它的文档。
有没有人能够成功地将 UIAction
与 Xcode 11 beta 3 一起使用?
我没看到你从哪里得到 options
参数。使用 Xcode 11 beta 3:
在我的机器上编译和运行(没有崩溃)
let action = UIAction(__title: "Howdy", image: nil, identifier: nil) {
_ in
}
查看 WWDC https://developer.apple.com/videos/play/wwdc2019/224/ 并转到时间 44:46。
Xcode 11 beta 3 不再接受此代码实例化 UIAction
:
let action = UIAction(__title: "title", image: someImage, options: []) { _ in
// some action
}
documentation 也没有。
我发现 a post on Apple Developer Forums 描述了同样的问题和现在被接受的语法,但它会导致运行时错误:
let action = UIAction(__title: "title", image: someImage, identifier: nil, handler: { _ in
// some action
}
+[UIAction actionWithTitle:image:identifier:handler:]: unrecognized selector sent to class 0x7fffa1b30178
还有这个新参数 identifier
,但我找不到任何关于如何使用它的文档。
有没有人能够成功地将 UIAction
与 Xcode 11 beta 3 一起使用?
我没看到你从哪里得到 options
参数。使用 Xcode 11 beta 3:
let action = UIAction(__title: "Howdy", image: nil, identifier: nil) {
_ in
}
查看 WWDC https://developer.apple.com/videos/play/wwdc2019/224/ 并转到时间 44:46。