=>动画
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 = NO2. 手指移出UITextView使其失去焦点
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
[textView resignFirstResponder]
}
本文介绍了使用Core Animation实现动画效果以及如何进行视图切换,包括CATransition的应用、视图层级交换和解决视图不响应事件的方法。同时,提供了解决手指移出UITextView使其失去焦点的代码示例。

被折叠的 条评论
为什么被折叠?



