首页 > 为什么用runtime获取不到uiview的alpha属性?

为什么用runtime获取不到uiview的alpha属性?

 unsigned int count = 0;
    Ivar *ivars = class_copyIvarList([UIView class], &count);
    for (unsigned int i = 0 ; i < count; i++) {
        Ivar ivar = ivars[i];
        //对属性进行解析
        const char *ivarName = ivar_getName(ivar);
        NSString *propertyName = [NSString stringWithUTF8String:ivarName];
        NSLog(@"propertyname:%@",propertyName);
    }
    free(ivars);
    
    
    
    objc_property_t *ivars = class_copyPropertyList([UIView class], &count);
    for (unsigned int i = 0 ; i < count; i++) {
        objc_property_t ivar = ivars[i];
        //对属性进行解析
        const char *ivarName = property_getName(ivar);
        NSString *propertyName = [NSString stringWithUTF8String:ivarName];
        NSLog(@"propertyname:%@",propertyName);
    }
    free(ivars);

用这两种方法都不行


是通过分类添加的属性

@interface UIView(UIViewRendering)

@property(nonatomic)                 CGFloat           alpha;                      // animatable. default is 1.0
【热门文章】
【热门文章】