今天无意中看到苹果官方文档中的一段描述:我看这明显是一个分类的声明,但分类中不是不能增加成员变量吗,请各位大侠帮忙解释一下- @interface UIView(UIViewGeometry)
- // animatable. do not use frame if view is transformed since it will not correctly reflect the actual location of the view. use bounds + center instead.
- @property(nonatomic) CGRect frame;
- // use bounds/center and not frame if non-identity transform. if bounds dimension is odd, center may be have fractional part
- @property(nonatomic) CGRect bounds; // default bounds is zero origin, frame size. animatable
- @property(nonatomic) CGPoint center; // center is center of frame. animatable
- @property(nonatomic) CGAffineTransform transform; // default is CGAffineTransformIdentity. animatable
- @property(nonatomic) CGFloat contentScaleFactor NS_AVAILABLE_IOS(4_0);
- @property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled; // default is NO
- @property(nonatomic,getter=isExclusiveTouch) BOOL exclusiveTouch; // default is NO
- - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; // recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system
- - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event; // default returns YES if point is in bounds
- - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;
- - (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view;
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view;
- - (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view;
- @property(nonatomic) BOOL autoresizesSubviews; // default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes
- @property(nonatomic) UIViewAutoresizing autoresizingMask; // simple resize. default is UIViewAutoresizingNone
- - (CGSize)sizeThatFits:(CGSize)size; // return 'best' size to fit given size. does not actually resize view. Default is return existing view size
- - (void)sizeToFit; // calls sizeThatFits: with current view bounds and changes bounds size.
- @end
复制代码
|
|