半页视图
UIWindow *win = [UIApplication sharedApplication].keyWindow;
[win addSubview:baseview];
self.fourview.hidden = YES;
self.twoview.hidden = NO;
self.threeview.hidden = YES;
self.oneview.hidden = YES;
添加视图。
动画效果:- (void)transitionWithType:(NSString *) type WithSubtype:(NSString *) subtype ForView : (UIView *) view
{/*
typedef enum : NSUInteger {
Fade = 1, //淡入淡出
Push, //推挤
Reveal, //揭开
MoveIn, //覆盖
Cube, //立方体
SuckEffect, //吮吸
OglFlip, //翻转
RippleEffect, //波纹
PageCurl, //翻页
PageUnCurl, //反翻页
CameraIrisHollowOpen, //开镜头
CameraIrisHollowClose, //关镜头
CurlDown, //下翻页
CurlUp, //上翻页
FlipFromLeft, //左翻转
FlipFromRight, //右翻转
} AnimationType;
*/
CATransition *animation = [CATransition animation];
animation.duration = 0.3;
animation.type = type;
if (subtype != nil) {
//设置子类
animation.subtype = subtype;
}
//设置运动速度 UIViewAnimationOptionCurveEaseInOut
// animation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.2 :0.03 :0.13 :1.0];
[view.layer addAnimation:animation forKey:@"animation"];
}
视图间切换:self.oneview.hidden = self.threeview.hidden = self.fourview.hidden = YES;
self.twoview.hidden = NO;
[self transitionWithType:kCATransitionPush WithSubtype:kCATransitionFromRight ForView:self.baseview];//切换动画效果pus.kCATransitionFromLeft/pop
//https://github.com/dingjuanjuan/aniview/tree/master