20160905,category

category
UIView+Util


@interface UIView (Util)

@property (nonatomic, assign ) CGFloat x;//不能用 下划线, 可以set ,get.                       主要是因为 没有用  实例变量。                  相当于        是对  我们 写的两个方法的 合并。




@implementation UIView (Util)

- (void)setX:(CGFloat)x {

    CGRect frame = self.frame;
    
    
    frame.origin.x = x;
    
    
    self.frame = frame;

}

- (CGFloat)x{

    return self.frame.origin.x;

}




你可能感兴趣的:(20160905,category)