Swift :Viewcontroller 对协议 UIGestureRecognizerDelegate 的冗余一致性
Swift : Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate
我想添加两个框架 SWRevealViewController
和 SLKTextViewController
但是我得到了这个奇怪的错误。
我读到了这个错误,但它看起来很混乱。
Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate
class Viewcontroller: SLKTextViewController,SWRevealViewControllerDelegate,UIGestureRecognizerDelegate {
// a lot of functions and code
}
错误的原因是您两次尝试符合UIGestureRecognizerDelegate
。一次明确地在开头写它,第二次通过扩展已经符合它的 SLKTextViewController
- the source code of SLKTextViewController
包含以下行:
NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController <UITextViewDelegate, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UIGestureRecognizerDelegate, UIAlertViewDelegate>
其中已经列出了 UIGestureRecognizerDelegate
!
的其他协议
解决方案:通过将代码更改为
删除UIGestureRecognizerDelegate
class Viewcontroller : SLKTextViewController, SWRevealViewControllerDelegate {
我想添加两个框架 SWRevealViewController
和 SLKTextViewController
但是我得到了这个奇怪的错误。
我读到了这个错误,但它看起来很混乱。
Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate
class Viewcontroller: SLKTextViewController,SWRevealViewControllerDelegate,UIGestureRecognizerDelegate {
// a lot of functions and code
}
错误的原因是您两次尝试符合UIGestureRecognizerDelegate
。一次明确地在开头写它,第二次通过扩展已经符合它的 SLKTextViewController
- the source code of SLKTextViewController
包含以下行:
NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController <UITextViewDelegate, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UIGestureRecognizerDelegate, UIAlertViewDelegate>
其中已经列出了 UIGestureRecognizerDelegate
!
解决方案:通过将代码更改为
删除UIGestureRecognizerDelegate
class Viewcontroller : SLKTextViewController, SWRevealViewControllerDelegate {