swift - 与 NavigationControllerDelegate 的冗余一致性

标签 swift xcode uinavigationcontroller

我有一个错误说 Redundant Conformance to Protocol UINavigationControllerDelegate

所以这是我的独立代码。

class DelegateProfileViewController: FormViewController, MFMailComposeViewControllerDelegate, UINavigationControllerDelegate  {


class ChatViewController: JSQMessagesViewController, UIActionSheetDelegate, UIImagePickerControllerDelegate, 
 UINavigationControllerDelegate {


class EditSubGroupViewController: FormViewController, SelectUsersFromSubGroupDelegate, SelectSingleFromSubGroupDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {



extension CreateEngagementViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {


class FeedViewController: UITableViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate, UITextFieldDelegate {

你明白了。这些错误中的每一个都会出现 Redundant Conformance of BLANK to protocol UINavigationControllerDelegate。

如果有人能告诉我为什么这些错误会破坏我的项目,我会很高兴。谢谢

最佳答案

如果子类声明符合已从父类(super class)继承的协议(protocol),您将收到该错误消息

举个例子:如果在你的情况下 FormViewController 已经符合 UINavigationControllerDelegate

class FormViewController: UINavigationControllerDelegate

那么就不需要通过这样做再次符合它:-

class DelegateProfileViewController: FormViewController, MFMailComposeViewControllerDelegate, UINavigationControllerDelegate

应该改为:-

class DelegateProfileViewController: FormViewController, MFMailComposeViewControllerDelegate

这将删除您的冗余一致性。希望您明白我在说什么。

关于swift - 与 NavigationControllerDelegate 的冗余一致性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44856466/

相关文章:

ios - 如何找到安全区域的高度和宽度?

ios - Xcode 和 Cocoapods 警告中的 EMBEDDED_CONTENT_CONTAINS_SWIFT

swift - 为什么 iPhone XS 在实时使用相机时的 CPU 性能比 iPhone 6S Plus 差?

ios - Libgdx IOS 不工作?

uinavigationcontroller - 在CCLayer中添加UINavigationController

ios - 如何在 swift iOS 中自定义导航 Controller

ios - 可调整大小 View 的圆角

swift - 如何让一个函数每天早上8点自动运行?

ios - UITableView + 核心动画

ios - 如何弹出回到 Root View Controller 然后推送到不同的 View ?