Category中的属性

来源:互联网 发布:淘宝直播是镜像吗 编辑:程序博客网 时间:2024/05/15 02:59

#import <objc/runtime.h>


static char UIScrollViewSpringHeadView;


@implementation UIScrollView (SpringHeadView)


- (void)setTopView:(UIView *)topView{

    objc_setAssociatedObject(self, &UIScrollViewSpringHeadView,

                             topView,

                             OBJC_ASSOCIATION_ASSIGN);

}


- (UIView *)topView{

    returnobjc_getAssociatedObject(self, &UIScrollViewSpringHeadView);

}

0 0
原创粉丝点击