=>动画
1. CATransition
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.3;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.type = kCATransitionMoveIn;
animation.subtype = kCATransitionFromRight;
[[self layer] addAnimation:animation forKey:@"exchange"];
2. 视图切换
NSInteger i = [self.subviews indexOfObject:view1];
NSInteger j = [self.subviews indexOfObject:view2];
[self exchangeSubviewAtIndex:i withSubviewAtIndex:j];
=>事件
1. 视图不响应事件
1) 在IB中视图属性的Interaction -> User Interaction Enable 不选中
2) 代码
view.userInteractionEnabled = NO
2. 手指移出UITextView使其失去焦点
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
[textView resignFirstResponder]
}