iOS-获取当前View所在的控制器
2016-08-12 14:33
447 查看
@interface UIView (CurrentController) /** 获取当前View的控制器对象 */ -(UIViewController *)getCurrentViewController; @end .m #import "UIView+CurrentController.h" @implementation UIView (CurrentController) /** 获取当前View的控制器对象 */ -(UIViewController *)getCurrentViewController{ UIResponder *next = [self nextResponder]; do { if ([next isKindOfClass:[UIViewController class]]) { return (UIViewController *)next; } next = [next nextResponder]; } while (next != nil); return nil; } @end
相关文章推荐
- ios8之后使用CLLocationManager进行定位
- ios 对于AFNetworking3.0之前版本的Get、Post请求的封装(直接调用即可)
- ios开发科大讯飞的语音识别
- iOS开发-底层篇-Class详解的讲解
- 浅谈iOS本地数据保存
- iOS,监听tableVIew的偏移量
- iOS开源项目
- iOS开发零碎知识点
- iOS项目功能大全,让你的项目一天搞定
- IOS 图片拉伸技巧
- iOS 修正拍出来的照片的方向
- ios 滤镜
- IOS实现展开二级列表效果
- iOS开发——测试证书的创建
- 设计比较好,有助于学习的Github上的iOS App源码 (中文)
- 设计比较好,有助于学习的Github上的iOS App源码 (中文)
- iOS---取出字符串中的数字
- iOS基础知识之@property 和 Ivar 的区别
- ios 开发之本地推送
- iOS 音乐播放Tool (配Demo下载)