jjzjj

ios - swift : Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate

coder 2023-09-05 原文

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

我读到了这个错误,但它看起来很困惑。

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>

在其他协议(protocol)中,它已经列出了 UIGestureRecognizerDelegate!

解决方案:通过将代码更改为

来移除UIGestureRecognizerDelegate
class Viewcontroller : SLKTextViewController, SWRevealViewControllerDelegate {

关于ios - swift : Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32540452/

有关ios - swift : Redundant conformance of Viewcontroller to protocol UIGestureRecognizerDelegate的更多相关文章

随机推荐