ios - pch文件中包含这个文件什么用?响应不是系统的事吗?
PHPz
PHPz 2017-04-17 17:37:07
0
1
213
#import "UIView+UIViewController.h"

@implementation UIView (UIViewController)
-(UIViewController *)viewController{
    UIResponder *next = self.nextResponder;
    while(next !=nil){
        if([next isKindOfClass:[UIViewController class]]){
            return (UIViewController *)next;
        }
        next = next.nextResponder;
    }
    return nil;
}
@end
PHPz
PHPz

学习是最好的投资!

reply all(1)
刘奇

This is a category. It can be seen from the code that the function of this category should be to get the object of its controller through View, that is, view.viewController

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template