标签:实例 类 viewcontroller ios
- (RootViewController *)<span style="font-family: Arial, Helvetica, sans-serif;">rootViewController</span> { UIResponder *next = self.nextResponder; do { if ([next isKindOfClass:[RootViewController class]]) { return (RootViewController *)next; } next = next.nextResponder; } while (next != nil); return nil; }
+ (RootViewController *)<span style="font-family: Arial, Helvetica, sans-serif;">rootV</span><span style="font-family: Arial, Helvetica, sans-serif;">iewControllerWithView:(UIView *)view</span> { UIResponder *next = view.nextResponder; do { if ([next isKindOfClass:[RootViewController class]]) { return (RootViewController *)next; } next = next.nextResponder; } while (next != nil); return nil; }
我个人感觉,类方法用的更好一些,他只用写在你需要的得到的实例的类中调用即可,VIew呢一般就是你的当前视图,而且只用写一次,在一定程度上减少了demo量
标签:实例 类 viewcontroller ios
原文地址:http://blog.csdn.net/u013243469/article/details/41479089