iOS CAAnimation(一)基础属性

先来看一下UIView和CALayer之间的关系:

CAlayer继承了NSObject,负责显示内容,不能响应事件,仅能判断某点是否在该视图内。- (BOOL)containsPoint:(CGPoint)p;

UIView继承了UIResponder,负责处理触摸事件,参与响应者链。每一个view都有关联了一个默认的CALayer对象,我们可以通过重写view的+(Class)layerClass方法来自定义关联到view上的layer。而且UIView还遵守了CALayerDelegate协议,并且将关联的layer的代理人设置为自己。

接着来看一下UIView的一些表示位置信息的属性:

@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

然后来看一下CALayer的一些表示位置信息的属性:

@property CGRect frame;
/* Unlike NSView, each Layer in the hierarchy has an implicit frame
 * rectangle, a function of the `position', `bounds', `anchorPoint',
 * and `transform' properties. When setting the frame the `position'
 * and `bounds.size' are changed to match the given frame. */
@property CGRect bounds;
/* The bounds of the layer. Defaults to CGRectZero. Animatable. */
@property CGPoint position;
/* The position in the superlayer that the anchor point o
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值