动画:UIKitAnimation 简单动画学习 iOS (一) 渐变 、 移动 、翻页、来回翻转
来源:互联网 发布:留学生免税车 知乎 编辑:程序博客网 时间:2024/04/30 11:37
转载请说明(谢谢)
http://blog.csdn.net/a21064346/article/details/7851695
点击打开链接
以下 一个系列的 动画效果 在 UIView.h文件中可以查找。但是比较炫丽的一些动画,就需要用到下一章节的coreAnimation。其中需要添加
QuartzCore
CoreGraphics
这两个framework
本人偷懒,就不搭建框架了。自己把方法复制到m文件里:)
//渐变 和 移动
- (UIGestureRecognizer *)createTapRecognizerWithSelector:(SEL)selector {
return [[[UITapGestureRecognizeralloc]initWithTarget:selfaction:selector]autorelease];
}
- (void)viewDidLoad {
[superviewDidLoad];
fadeMeView = [[UIViewalloc]initWithFrame:CGRectMake(55,40,210,160)];
fadeMeView.backgroundColor = [UIColorcolorWithRed:0.580green:0.706blue:0.796alpha:1.000];
[self.viewaddSubview:fadeMeView];
moveMeView = [[UIViewalloc]initWithFrame:CGRectMake(55,220,210,160)];
moveMeView.backgroundColor = [UIColorcolorWithRed:1.000green:0.400blue:0.400alpha:1.000];
[self.viewaddSubview:moveMeView];
[fadeMeViewaddGestureRecognizer:[selfcreateTapRecognizerWithSelector:@selector(fadeMe)]];
[moveMeViewaddGestureRecognizer:[selfcreateTapRecognizerWithSelector:@selector(moveMe)]];
}
- (void)fadeMe {
[UIViewanimateWithDuration:1.0animations:^{
fadeMeView.alpha = 0.0f;
}];
}
- (void)moveMe {
[UIViewanimateWithDuration:0.5animations:^{
moveMeView.center = CGPointMake(moveMeView.center.x,moveMeView.center.y -200);
}];
}
//翻书 翻页效果
- (void)CurlUp {
[UIViewtransitionWithView:noteViewduration:0.6
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
NSString *currentText =noteView.text;
noteView.text =nextText;
self.nextText = currentText;
}completion:^(BOOL finished){
}];
}
//同一容器中, view 左右来回翻转替换
- (void)viewDidLoad {
[superviewDidLoad];
self.title = [[selfclass]displayName];
// Set the background color for the window. The user will see the window's background color on the transition.
UIColor *backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"pattern.png"]];
[UIApplicationsharedApplication].keyWindow.backgroundColor = backgroundColor;
frontView = [[UIViewalloc]initWithFrame:self.view.bounds];
frontView.backgroundColor = [UIColorcolorWithRed:0.345green:0.349blue:0.365alpha:1.000];
UIImageView *caLogoView = [[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"caLogo.png"]];
caLogoView.frame =CGRectMake(70,80, caLogoView.bounds.size.width, caLogoView.bounds.size.height);
[frontViewaddSubview:caLogoView];
UIImage *backImage = [UIImageimageNamed:@"backView.png"];
backView = [[UIImageViewalloc]initWithImage:backImage];
backView.userInteractionEnabled = YES;
[self.viewaddSubview:backView];
[self.viewaddSubview:frontView];
displayingFrontView =YES;
UIGestureRecognizer *frontViewTapRecognizer = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(flipViews)];
UIGestureRecognizer *backViewTapRecognizer = [[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(flipViews)];
[frontViewaddGestureRecognizer:frontViewTapRecognizer];
[backViewaddGestureRecognizer:backViewTapRecognizer];
[frontViewTapRecognizerrelease];
[backViewTapRecognizerrelease];
}
- (void)flipViews {
[UIViewtransitionFromView:(displayingFrontView) ?frontView : backView
toView:(displayingFrontView) ? backView : frontView
duration:0.75
options:(displayingFrontView ?UIViewAnimationOptionTransitionFlipFromRight :UIViewAnimationOptionTransitionFlipFromLeft)
completion:^(BOOL finished) {
if (finished) {
displayingFrontView = !displayingFrontView;
}
}];
}
- 动画:UIKitAnimation 简单动画学习 iOS (一) 渐变 、 移动 、翻页、来回翻转
- 动画:UIKitAnimation 简单动画----渐变 、 移动 、翻页、来回翻转
- iOS动画-UIKitAnimation
- IOS翻转动画(可来回切换图片)
- 简单翻页动画实现
- IOS翻页动画
- iOS翻页动画
- 动画效果之简单的移动和移动渐变色
- ios动画学习(一)
- ios 渐变动画
- 【IOS动画】UIView翻转
- iOS 动画之翻页动画实现
- ios的翻页动画效果
- iOS翻页动画-CATransition
- iOS:CAAnimation动画集合:移动/旋转/缩放/弹簧/翻页效果/落叶动画
- iOS学习之简单动画
- iOS 基于UIView抖动 来回移动 缩放 翻转效果
- 动画效果(一)-渐变动画
- 英语国名的笑话
- PHP读取MySQL生成XML格式数据
- HTML meta refresh 刷新与跳转(重定向)页面
- ASP.NET ASHX 一般处理程序教程
- 1989年
- 动画:UIKitAnimation 简单动画学习 iOS (一) 渐变 、 移动 、翻页、来回翻转
- 2011—2012(第四届)中国嵌入式开发从业人员调查报告
- MyBatis3整合Spring3、SpringMVC3
- return null 与return new List<HaierPageView>()的区别
- 用时间的方法获得各不相同的数,用于数据库的主键
- Linux下的Memcache高效缓存的安装 .
- C++函数的学习(二)
- JMS/JMX/COBOL
- iOS 5新特性抢先看(转载)