addGestureRecognizer: 这个方法进行手势识别
父控件和子控件: 一个父控件可以包含多个子控件,但是子空间只能有一个父控件.可以通过
clipsToBounds
来设置边界部分.默认为NO.
insertSubview:belowSubview:
exchangeSubviewAtIndex:withSubviewAtIndex:
setNeedsLayout
方法是强制view更新自己的布局
drawRect:
方法.
setNeedsDisplay
或者
setNeedsDisplayInRect:
通知系统view要重绘.
@property frame
@property bounds
@property center
@property transform
@property alpha
@property backgroundColor
@property contentStretch
layerClass:
如果你想使用自定义的Core Animation,需要覆盖此方法
drawRect:
自定义的时候实现此方法.如果不做任何自定义,避免重写此方法.
alignmentRectForFrame:
,
frameForAlignmentRect:
视图之间的位置关系
sizeThatFits:
当你想view在改变大小的时候不是默认的大小.比如你可以使用这个方法来防止子视图在缩小过程中不能正确显示.
layoutSubviews
当你想精确的控制子视图的布局(而不是约束和autoresizing)
didAddSubview:
,
willRemoveSubview:
跟踪子视图的添加和删除操作
willMoveToSuperview:
,
didMoveToSuperview
在视图层次中踪当前视图的跳转
willMoveToWindow:
,
didMoveToWindow
跟踪view跳到不同的window
事件处理(event handling)
1>
touchesBegan:withEvent:
,
touchesMoved:withEvent:
,
touchesEnded:withEvent:
,
touchesCancelled:withEvent:
触摸事件(对于基于手势的输入,使用 gesture recognizers)
gestureRecognizerShouldBegin:
如果你view需要直接处理touch事件,或者防止附着的手势触发其他操作.