美文网首页
oc类属性

oc类属性

作者: 码农淏 | 来源:发表于2017-03-19 18:45 被阅读175次

    写过的代码都忘了怎么写了- -还是写写笔记吧

    Swift 3.0 令人兴奋,但Objective-C也有小改进--Objective-C的类属性
    http://www.cocoachina.com/ios/20161202/18257.html

    .h中

    @property (class, nonatomic, assign)NSInteger idx;
    

    .m中

    static NSInteger _idx = 0;
    + (NSInteger)idx {
        _idx++;
        return _idx;
    }
    + (void)setIdx:(NSInteger)idx {
        _idx = idx;
    }
    

    使用

    ZYSlideCell.idx = 1;
    

    相关文章

      网友评论

          本文标题:oc类属性

          本文链接:https://www.haomeiwen.com/subject/lhkvnttx.html