iOS 开发:运行时,查看对象的成员属性
2016-10-28 00:00
483 查看
//运行时,看有哪些成员变量
unsigned int count ;
Ivar *ivarList = class_copyIvarList([UIRefreshControl class], &count);
for (int i = 0; i<count; i++) {//便利所有的成员属性
Ivar ivar = ivarList[i];
NSLog(@"%s",ivar_getName(ivar));
}
free(ivarList);
注意:要导入头文件:#import <objc/message.h>
打印的结果
2016-10-28 11:00:17.862582 test[5765:941929] _style
2016-10-28 11:00:17.862614 test[5765:941929] _contentView
2016-10-28 11:00:17.862622 test[5765:941929] _scrollView
2016-10-28 11:00:17.862628 test[5765:941929] _refreshControlHeight
2016-10-28 11:00:17.862635 test[5765:941929] _visibleHeight
2016-10-28 11:00:17.862641 test[5765:941929] _snappingHeight
2016-10-28 11:00:17.862647 test[5765:941929] _additionalTopInset
2016-10-28 11:00:17.862656 test[5765:941929] _insetsApplied
2016-10-28 11:00:17.862662 test[5765:941929] _adjustingInsets
2016-10-28 11:00:17.862668 test[5765:941929] _automaticContentOffsetAdjustmentEnabledWhenLastIdle
2016-10-28 11:00:17.862674 test[5765:941929] _automaticContentOffsetAdjustmentEnabledNeedsReset
2016-10-28 11:00:17.862680 test[5765:941929] _appliedInsets
2016-10-28 11:00:17.862686 test[5765:941929] _refreshControlState
unsigned int count ;
Ivar *ivarList = class_copyIvarList([UIRefreshControl class], &count);
for (int i = 0; i<count; i++) {//便利所有的成员属性
Ivar ivar = ivarList[i];
NSLog(@"%s",ivar_getName(ivar));
}
free(ivarList);
注意:要导入头文件:#import <objc/message.h>
打印的结果
2016-10-28 11:00:17.862582 test[5765:941929] _style
2016-10-28 11:00:17.862614 test[5765:941929] _contentView
2016-10-28 11:00:17.862622 test[5765:941929] _scrollView
2016-10-28 11:00:17.862628 test[5765:941929] _refreshControlHeight
2016-10-28 11:00:17.862635 test[5765:941929] _visibleHeight
2016-10-28 11:00:17.862641 test[5765:941929] _snappingHeight
2016-10-28 11:00:17.862647 test[5765:941929] _additionalTopInset
2016-10-28 11:00:17.862656 test[5765:941929] _insetsApplied
2016-10-28 11:00:17.862662 test[5765:941929] _adjustingInsets
2016-10-28 11:00:17.862668 test[5765:941929] _automaticContentOffsetAdjustmentEnabledWhenLastIdle
2016-10-28 11:00:17.862674 test[5765:941929] _automaticContentOffsetAdjustmentEnabledNeedsReset
2016-10-28 11:00:17.862680 test[5765:941929] _appliedInsets
2016-10-28 11:00:17.862686 test[5765:941929] _refreshControlState
相关文章推荐
- iOS开发中 类、对象、实例变量、成员变量、属性变量等区别和关系
- iOS运行时机制之成员和属性,关联对象
- iOS Runtime 运行时之二:成员和属性,关联对象
- IOS开发中 类、对象、实例变量、成员变量、属性变量等区别和关系
- 【iOS开发-40】不能直接修改对象的结构体属性的成员,那怎么办?
- iOS运行时获取对象的成员变量和成员方法
- ios开发-成员变量,属性变量随笔
- objective-c运行时机制runtime,动态获取对象的属性和成员变量
- iOS运行时获取对象的成员变量和成员方法
- iOS学习笔记56(Runtime)-Objective-C Runtime 运行时之二:成员变量与属性
- 【iOS开发-25】UIDevice查看系统信息,从一个问题開始怎样高速找到自己想要的属性和方法并看懂它
- iOS运行时的用途三 -- 获得属性名,方法名,成员变量名
- iOS开发之关于Runtime运行时:类与对象
- 【Swift】ios开发中巧用 description 打印对象时,打印对象的属性
- 【IOS 开发】Object - C 面向对象 - 类 , 对象 , 成员变量 , 成员方法
- iOS 高级开发技巧 2.对象、消息、运行期 (一) 理解属性这一概念
- 【iOS开发-7】UILabel类的用法以及实例化对象的各种属性介绍
- iOS开发-OC之知识树,知识点(包括对象、Block、消息转发、GCD、运行时、runloop、动画、Push、KVO、tableview,UIViewController、提交AppStore)
- iOS开发属性与成员变量的区别
- 【IOS 开发】Object - C 面向对象 - 类 , 对象 , 成员变量 , 成员方法