在我的interactivePopGestureRecognizer
我检查过,如果它有一个属性class UINavigationControllerExtended: UINavigationController, UIGestureRecognizerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
if self.respondsToSelector(Selector("interactivePopGestureRecognizer")) {
self.navigationController?.interactivePopGestureRecognizer?.delegate = self
}
}
}
,我将其设置为:
respondsToSelector
属性可以设置为nil,但属性仍然存在,所以我假设Congratulation , You just bought new item. Details are given below :
Condition: New
Condition note: Brand New - We have fast shipping!
Listing ID: xxxxxxxx
SKU: TX969666
Quantity: 1
Order date: 01/08/2016
Price: $14.95
Shipping: $0.00
总是返回true。是否有必要对此进行检查?
答案 0 :(得分:1)
在iOS 7中添加了interactivePopGestureRecognizer
属性。检查respondsToSelector
是否存在是没有意义的。只需使用它。
因为您使用可选链接调用它,如果interactivePopGestureRecognizer
属性为nil
,则:
self.navigationController?.interactivePopGestureRecognizer?.delegate = self
将安全无所作为。