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);用这两种方法都不行
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
是通过分类添加的属性