【发布时间】:2013-12-19 23:00:57
【问题描述】:
我有一个扩展 UIViewController 的 X 类。令我惊讶的是,这个类可以有以下代码:
[self.navigationController popViewControllerAnimated:YES];
据我所知,navigationController 是 UINavigationController.h 中的类别添加的属性:
@interface UIViewController (UINavigationControllerItem)
@property(nonatomic,readonly,retain) UINavigationController *navigationController;
@end
我的类扩展了 UIViewController,而不是 UINavigationController,而且我看不到这个类别被引用的方式。我以为我必须导入类别才能访问它声明的成员。那么 UIViewController 如何访问在另一个不相关的头文件中声明的属性呢?
谢谢, 亚诺斯
【问题讨论】:
-
它已经通过添加“
”为您导入,想想UINavigationController然后您是否导入了“UINavigationController.h”来使用UINavigationController? UIButton 怎么样? UILabel?...同样的事情.. -
好的,非常感谢!我现在可以睡觉了;)
标签: ios objective-c uiviewcontroller uinavigationcontroller