UIView动画With Block
来源:互联网 发布:science域名 编辑:程序博客网 时间:2024/05/29 04:35
- (void)viewDidLoad{ [super viewDidLoad]; self.smallRect = CGRectMake(0, 0, 20, 30); self.bigRect = CGRectMake(0, 0, 200, 300); //创建一个按钮 UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.backgroundColor = [UIColor lightGrayColor]; [btn addTarget:self action:@selector(onPressButton:) forControlEvents:UIControlEventTouchUpInside]; btn.frame = CGRectMake(150, 300, 120, 30); [self.view addSubview:btn]; //创建imgView self.imgview = [[UIImageView alloc] initWithFrame:_smallRect]; _imgview.backgroundColor = [UIColor redColor]; [self.view addSubview:_imgview];}//button触发事件-(void)onPressButton:(id)sender{ //*************第一种 动画blcok ********** [UIView animateWithDuration:2 animations:^{ _imgview.frame = self.bigRect; }]; //*************第二种 动画blcok ********** //带一个回调 [UIView animateWithDuration:2 animations:^{ self.imgview.frame = self.bigRect; } completion:^(BOOL finished) { self.imgview.backgroundColor = [UIColor blackColor]; }]; //*************第三种 动画blcok ********** //带一个延迟 [UIView animateWithDuration:2 delay:5 options:UIViewAnimationOptionAutoreverse animations:^{ self.imgview.frame = self.bigRect; } completion:^(BOOL finished) { if (finished) { self.imgview.backgroundColor = [UIColor blackColor]; } }];}
0 0
- UIView动画With Block
- UIView block动画
- iOS UIView Block动画
- iOS UIView Block动画(块儿动画)
- iOS动画--UIView自带动画效果、Block动画
- iOS 动画Animation详解, UIView动画(UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- iOS 动画Animation详解, UIView动画(UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- iOS 动画Animation详解, UIView动画(UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- UIView+block动画和CALayer动画的区别
- iOS中的动画:核心动画Core Animation, UIView动画, Block动画, UIImageView的帧动画.
- UIView视图移动,抖动效果,定时器,动画block
- UI 动画之UIView动画的 四种 使用含有block的类方法 实现动画
- IOS 五种动画详解 CAAnimation、UIView动画、Block动画、UIImageView
- UI_动画-UIView属性动画、block块、仿设变换、CAAnimation
- UIView动画
- UIView 动画
- UIView动画
- 如何查看JDK所支持的JAXB版本
- java String的常量池
- cocos2d-x3.0 android播放视频
- ASSCII码的一点认识
- innerHTML 和 pasteHTML 区别
- UIView动画With Block
- Cocos2d-x相关的博客以及官网信息
- Armstrong数
- VMWare Workstation 中的linux系统无法联网
- jetty eclipse 整合一
- DOM 简介
- 20140711_类的继承、派生、ACE框架、指针的问题、系统的问题
- Linux:如何在connect后获得源端口?
- 10解析函数(四)