一个滑出view 的动画
来源:互联网 发布:sqlserver 2005 sp4 编辑:程序博客网 时间:2024/05/29 14:50
#import "ViewController.h"
#define width ([UIScreen mainScreen].bounds.size.width)
#define height ([UIScreen mainScreen].bounds.size.height)
@interface ViewController ()
@property(nonatomic, strong)UIView *rightview;
@property(nonatomic, assign)NSInteger index;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor cyanColor];
self.rightview = [[UIView alloc] init];
self.rightview.frame = self.view.frame;
self.rightview.center = CGPointMake(1.5 * width, height/2);
self.rightview.backgroundColor = [UIColor redColor];
[self.view addSubview:self.rightview];
UIGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(press)];
[self.view addGestureRecognizer:gesture];
}
//
- (void)press{
//out
if (self.index%2 == 1) {
[UIView beginAnimations:@"23" context:nil];
[UIView setAnimationDuration:1];
self.rightview.center = CGPointMake(width*3/4, height/2);
[UIView commitAnimations];
}else{
[UIView beginAnimations:@"123" context:nil];
[UIView setAnimationDuration:1];
self.rightview.center = CGPointMake(1.5 * width, height/2);
[UIView commitAnimations];
}
self.index++;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
#define width ([UIScreen mainScreen].bounds.size.width)
#define height ([UIScreen mainScreen].bounds.size.height)
@interface ViewController ()
@property(nonatomic, strong)UIView *rightview;
@property(nonatomic, assign)NSInteger index;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor cyanColor];
self.rightview = [[UIView alloc] init];
self.rightview.frame = self.view.frame;
self.rightview.center = CGPointMake(1.5 * width, height/2);
self.rightview.backgroundColor = [UIColor redColor];
[self.view addSubview:self.rightview];
UIGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(press)];
[self.view addGestureRecognizer:gesture];
}
//
- (void)press{
//out
if (self.index%2 == 1) {
[UIView beginAnimations:@"23" context:nil];
[UIView setAnimationDuration:1];
self.rightview.center = CGPointMake(width*3/4, height/2);
[UIView commitAnimations];
}else{
[UIView beginAnimations:@"123" context:nil];
[UIView setAnimationDuration:1];
self.rightview.center = CGPointMake(1.5 * width, height/2);
[UIView commitAnimations];
}
self.index++;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
1 0
- 一个滑出view 的动画
- 从底部滑出动画引发的关于View的一点理解
- 添加侧滑手势,滑出一个view
- 当点击一个View时,显示下面隐藏的一个View(折叠的动画效果)
- 一个酷炫动画 View
- mac 如何实现一个view自转的动画
- 一个简单的自定义view(补间动画)
- 一个用粒子动画显示文字的 Android 自定义 View
- Android自定义一个带缩放动画的倒计时View
- Android自定义View:一个精致的打钩小动画
- prensent一个半透明的viewcontroller 或者push 出一个viewcontroller 做present 动画
- View的抖动动画
- View的动画效果
- Android的View动画
- Android的View动画
- Activity左边滑出,右边滑入的动画切换
- Activity左边滑出,右边滑入的动画切换
- Android的PopWindow动画实现底部滑出菜单
- 串口收发中文问题
- UDP编程
- Android 异常之NullPointerException
- javax.servlet.jsp.PageContext cannot be resolved to a type
- lua math库
- 一个滑出view 的动画
- 原生js写tab
- iOS之CAEmitterLayer详解
- Android快速SDK(20)视频播放器VideoPlayerE【傻瓜模式】
- c++ 异常处理
- Linux 下安装及配置heartbeat
- OS Diary Day2 monitor.c
- 伪基站 + 钓鱼 = 完美黑产
- Apache Commons 工具集使用简介