【问题标题】:Swift : Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegateSwift:Viewcontroller 对协议 UIGestureRecognizerDelegate 的冗余一致性
【发布时间】:2015-12-09 00:25:13
【问题描述】:

我想添加两个框架 SWRevealViewControllerSLKTextViewController 但我收到了这个奇怪的错误。

我读到过这个错误,但看起来很混乱。

Viewcontroller 对协议 UIGestureRecognizerDelegate 的冗余一致性

class Viewcontroller: SLKTextViewController,SWRevealViewControllerDelegate,UIGestureRecognizerDelegate {

    // a lot of functions and code

}

【问题讨论】:

    标签: ios iphone swift swrevealviewcontroller


    【解决方案1】:

    错误的原因是您尝试两次符合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 {
    

    【讨论】:

      猜你喜欢
      • 2016-03-21
      • 2018-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-03
      • 1970-01-01
      • 2016-03-10
      相关资源
      最近更新 更多