
if activityVIEwController.respondsToSelector("popoverPresentationController") {} 但是,使用以下作为替换失败并生成错误,说#selector的参数不能引用属性
if activityVIEwController.respondsToSelector(#selector(popoverPresentationController)) {} 使用#selector实现此检查的正确方法是什么?
您可以使用以下内容:if activityVIEwController.respondsToSelector(Selector("popoverPresentationController")) {} 或者,如果您只针对iOS
if #available(iOS 8.0,*) { // You can use the property like this activityVIEwController.popoverPresentationController?.sourceVIEw = sourceVIEw} else {} 或者,如果您的代码不仅限于iOS
#if os(iOS) if #available(iOS 8.0,*) { activityVIEwController.popoverPresentationController?.sourceVIEw = sourceVIEw } else { }#endif 总结 以上是内存溢出为你收集整理的swift – #selector的参数不能引用属性全部内容,希望文章能够帮你解决swift – #selector的参数不能引用属性所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)