LMAlertView
是一个使用 objective-c 的三部分,我用了很长时间,一切顺利。但是当我在 swift 中使用它时,发生了一些奇怪的事情:当我编写 init
,Xcode 提醒我,我只需点击回车键,这样整个功能就自动完成了。但是 Xcode 显示的功能并不是 LMAlertView 中的真正功能:
这是 LMAlertView 中的源代码:
- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
如您所见,参数 otherButtonTitles
在我的代码中丢失了,它使用 Xcode 自动完成。
如果我将 otherButtonTitles
参数添加到我的代码中,它将构建失败。
我该如何解决这个问题?如果有人能阐明一些想法,那就太好了。
最佳答案
在 Swift 中尝试一下
let alertView = LMAlertView(title: "YourTitle",message:"your Message" delegate:nil cancelButtonTitle:"cancel" otherButtonTitles:nil)
关于ios - 当我快速调用 objective-c 方法时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45563579/