A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© 每天进步一点点 中级黑马   /  2014-7-1 22:26  /  1035 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

今天无意中看到苹果官方文档中的一段描述:我看这明显是一个分类的声明,但分类中不是不能增加成员变量吗,请各位大侠帮忙解释一下
  1. @interface UIView(UIViewGeometry)

  2. // 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.
  3. @property(nonatomic) CGRect            frame;

  4. // use bounds/center and not frame if non-identity transform. if bounds dimension is odd, center may be have fractional part
  5. @property(nonatomic) CGRect            bounds;      // default bounds is zero origin, frame size. animatable
  6. @property(nonatomic) CGPoint           center;      // center is center of frame. animatable
  7. @property(nonatomic) CGAffineTransform transform;   // default is CGAffineTransformIdentity. animatable
  8. @property(nonatomic) CGFloat           contentScaleFactor NS_AVAILABLE_IOS(4_0);

  9. @property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled;   // default is NO
  10. @property(nonatomic,getter=isExclusiveTouch) BOOL       exclusiveTouch;         // default is NO

  11. - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;   // recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system
  12. - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;   // default returns YES if point is in bounds

  13. - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;
  14. - (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view;
  15. - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view;
  16. - (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view;

  17. @property(nonatomic) BOOL               autoresizesSubviews; // default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes
  18. @property(nonatomic) UIViewAutoresizing autoresizingMask;    // simple resize. default is UIViewAutoresizingNone

  19. - (CGSize)sizeThatFits:(CGSize)size;     // return 'best' size to fit given size. does not actually resize view. Default is return existing view size
  20. - (void)sizeToFit;                       // calls sizeThatFits: with current view bounds and changes bounds size.

  21. @end
复制代码



0 个回复

您需要登录后才可以回帖 登录 | 加入黑马