以我TheTabBarController,而不符合UINavigationControllerDelegate协议,我可以分配我的类moreNavigationController.delegate。实施方法不符合协议
// without conforming to protocol, <UINavigationControllerDelegate>
@interface TheTabBarController : UITabBarController
self.moreNavigationController.delegate = self;
它只是引发下面的警告,但编译成功。
分配到 'TheTabBarController * const的__strong'
这种协议的方法在运行时调用没有任何错误从不相容 类型的 'id'。我用它来隐藏一些视图控制器的更多导航栏。
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
所以,我想知道,这是合法的,安全的或;它会在以后崩溃还是泄漏内存?这怎么可能在语义上被允许?运行时如何解决该方法,尽管它在界面中没有定义并且协议不符合?或者,UITabBarController使用符合协议的隐藏类别?