在objC中还真有一个类方法class,可以得到当前实例变量的类型。
define:
+(Class)class;
example:
UIViewController *vc=[[UIViewController alloc] init];
NSLog(@"vc type is :%@",[vc class]);
define:
+(Class)class;
example:
UIViewController *vc=[[UIViewController alloc] init];
NSLog(@"vc type is :%@",[vc class]);
解决方案 »
- 关于HTML5移动开发
- 请教一下html5的cocos2d我按照教程来做可是效果出不来
- ipone文档的具体位置
- 分享代码:关于IOS APNS推送消息(iphone端+PHP服务端)
- 对NSLayoutConstraint掌握的高手求教:对于自定义tableviewCell 的时候采用这种自动布局。UIlabel换行的这种就会出现行高偏差。
- Missing required icon file.。。。。 for iPad
- ipad mini 不能全屏
- TableView无法点击最后一行
- iOS 中使用FMDB 查询最大值 一直提示I could not find the column named 'id'
- iOS项目移植
- 程序进入后台,再回到前台,tableView刷新崩溃[UIImage isKindOfClass:]message sent to deallocated
- 调试一段tableview利用coredata进行分组和插入数据的代码
比如直接[UIViewController class]就行了。
@property(nonatomic,strong)Class2 b;
@property(nonatomic,strong)Class3 c; -(void)inject:(argc...)
{
[defaultFactory componentForType:参数的类名];
}
argc...:传进来的参数是不定个数的,
然后在函数中需要知道变量是那个类的。
问题:如果用object_getClassName 或者 (Class)class 的话,因为类变量a、b、c 没alloc,所以得到的是空,,有没有其他的解决办法呢??