iOS学习之动画效果的实现
来源:互联网 发布:红旗linux界面图 编辑:程序博客网 时间:2024/04/30 09:21
//
// ViewController.m
// UI-动画练习
//
// Created by jzq_mac on 15/7/22.
// Copyright (c) 2015年 jzq_mac. All rights reserved.
//
#import "ViewController.h"
@interfaceViewController ()
{
UIImageView *animation;
UIView *view;
UIView *view1;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
[selfcreatView];
[NSTimerscheduledTimerWithTimeInterval:10target:selfselector:@selector(creatView)userInfo:nilrepeats:YES];
}
- (void)creatView
{
//动态图并移动动态图
animation = [[UIImageViewalloc]initWithFrame:CGRectMake(86,0, 200,200)];
animation.layer.cornerRadius =100;
animation.layer.masksToBounds =YES;
NSMutableArray *list = [NSMutableArrayarray];
for (int i =1; i <= 15; i++) {
NSString *name = [NSStringstringWithFormat:@"动态猫-%d(被拖移).tiff",i];
[listaddObject:[UIImageimageNamed:name]];
}
animation.animationImages = list;
animation.animationDuration =5;
animation.animationRepeatCount = -1;
[animationstartAnimating];
[UIViewanimateWithDuration:5animations:^{animation.frame =CGRectMake(86,500, 200,200 );}completion:^(BOOL finishied){[UIViewanimateWithDuration:5animations:^{animation.frame =CGRectMake(86,0, 200,200);}];}];
[self.viewaddSubview:animation];
// 移动视图
self.view.backgroundColor = [UIColorgrayColor];
view =[[UIViewalloc]initWithFrame:CGRectMake(0,0, 100,100)];
view.backgroundColor = [UIColorredColor];
view.layer.cornerRadius =50;
[self.viewaddSubview:view];
[UIViewanimateWithDuration:5animations:^{view.frame =CGRectMake(275,550, 100, 100);}completion:^(BOOL finished){[UIViewanimateWithDuration:5animations:^{view.frame =CGRectMake(0,0, 100,100);}];}];
view.alpha =1;
[UIViewanimateWithDuration:10animations:^{view.alpha =0;}];
view1 =[[UIViewalloc]initWithFrame:CGRectMake(275,0, 100,100)];
view1.backgroundColor = [UIColoryellowColor];
view1.layer.cornerRadius =50;
[self.viewaddSubview:view1];
view1.alpha =1;
[UIViewanimateWithDuration:10animations:^{view1.alpha =0;}];
[UIViewanimateWithDuration:5animations:^{view1.frame =CGRectMake(0,550, 100, 100);}completion:^(BOOL finished){[UIViewanimateWithDuration:5animations:^{view1.frame =CGRectMake(275,0, 100,100);}];}];
}
//- (void)click:(UIButton *)sender
//{
// if (sender.selected !=YES ) {
// sender.selected = YES;
// [animation startAnimating];
// [sender setTitle:@"开始" forState:UIControlStateNormal];
//
// }else{
// sender.selected = NO;
// [animation stopAnimating];
// [sender setTitle:@"暂停" forState:UIControlStateSelected];
// }
//}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
- iOS学习之动画效果的实现
- iOS学习之动画效果的实现
- IOS开发之UIView动画效果的实现
- IOS开发之UIView动画效果的实现
- IOS开发-UIView之动画效果的实现方法
- IOS开发-UIView之动画效果的实现方法
- iOS开发-UIView之动画效果的实现方法
- IOS开发-UIView之动画效果的实现方法(
- iOS开发之iOS中的动画实现,通过CAShapeLayer、CAShapeLayer,CAReplicatorLayer实现炫酷的动画、雷达效果,波纹效果,咻一咻效果。iOS核心动画实现。
- iOS 之动画效果和实现
- IOS学习之核心动画-粒子效果
- Android学习之动画效果的实现、自定义控件皮肤
- ios动画效果学习
- ios动画效果学习
- ios动画效果学习
- IOS之动画效果
- iOS-实现简单的动画效果
- ios气泡动画效果的简单实现
- ubuntu下apt-get 命令参数
- #define 中的“#”和“##”
- 在linux中使用vi 打开文件时,能显示行号吗?http://zhidao.baidu.com/link?url=km4N-VLhK1DtSUOexgWMiZ73tp7R91g2UhZ15eTZv4
- C 基础知识点讲解1
- android 开发画虚线、实线,画圆角矩形,一半圆角
- iOS学习之动画效果的实现
- [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket错误解决方法总结
- 简单并查集之按秩合并——The Suspects
- 如何评价电影《西游记之大圣归来》?
- HDU5312string类的字符串赋值函数和查找函数
- Spring IOC源码详解之容器依赖注入
- The return type is incompatible with JspSourceDependent.getDependants():JasperException问题分析与解决方法
- 博客第一天
- 欢迎使用CSDN-markdown编辑器