ios - pch文件中包含这个文件什么用?响应不是系统的事吗?
PHPz
PHPz 2017-04-17 17:37:07
0
1
222
#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

学习是最好的投资!

全部回覆(1)
刘奇

這是類別,透過程式碼可以看出這個類別的作用應該是透過 View 來拿到其所在控制器的物件,即 view.viewController

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板