IOS 会动的登录界面
2016-06-17 17:12
429 查看
引言
动画一直是笔者最喜欢的,在现在广大的APP市场中,很多相似的软件拼功能已经无法获得用户群体,要做到让用户喜欢,体验是重中之重。一个好的动画效果,不仅能提升逼格,还能提高用户体验。会动的登录界面
先来看看效果吧是不是感觉挺炫酷的!
原型界面
我们可以看到原型界面是一张颜色渐变的背景图片,上面添加几个模糊的气泡。作为一名程序员,当然十八般武艺样样精通最好。这个界面笔者是用Sketch软件制作的,类似PhotoShop,但是做APP界面更加快捷方便,而且上手非常简单,大家空余时间也可以学学自己当设计师^^。传送门代码
这个界面效果主要是用view层动画组合而成@interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *cicleImage; @property (weak, nonatomic) IBOutlet UITextField *userNameText; @property (weak, nonatomic) IBOutlet UITextField *passwordText; @property (weak, nonatomic) IBOutlet UIImageView *bubble1; @property (weak, nonatomic) IBOutlet UIImageView *bubble2; @property (weak, nonatomic) IBOutlet UIImageView *bubble3; @property (weak, nonatomic) IBOutlet UIImageView *bubble4; @property (weak, nonatomic) IBOutlet UIImageView *bubble5; @property (weak, nonatomic) IBOutlet UIImageView *bubble6; @property (weak, nonatomic) IBOutlet UIButton *login; @property (weak, nonatomic) IBOutlet UIView *wrongView; @property (nonatomic, strong) UIActivityIndicatorView *spinner; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; self.bubble1.transform = CGAffineTransformMakeScale(0, 0); self.bubble2.transform = CGAffineTransformMakeScale(0, 0); self.bubble3.transform = CGAffineTransformMakeScale(0, 0); self.bubble4.transform = CGAffineTransformMakeScale(0, 0); self.bubble5.transform = CGAffineTransformMakeScale(0, 0); CGFloat x; x -= self.view.bounds.size.width/2; self.cicleImage.center = CGPointMake(x, self.cicleImage.center.y); } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [UIView animateWithDuration:0.3 delay:0.3 options:0 animations:^{ self.bubble1.transform = CGAffineTransformMakeScale(1, 1); self.bubble2.transform = CGAffineTransformMakeScale(1, 1); self.bubble5.transform = CGAffineTransformMakeScale(1, 1); self.bubble6.transform = CGAffineTransformMakeScale(1, 1); } completion:nil]; [UIView animateWithDuration:0.3 delay:0.3 options:0 animations:^{ self.bubble3.transform = CGAffineTransformMakeScale(1, 1); self.bubble4.transform = CGAffineTransformMakeScale(1, 1); } completion:nil]; [UIView animateWithDuration:4 delay:1 usingSpringWithDamping:0.1 initialSpringVelocity:2 options:3 animations:^{ CGFloat x; x += 50; self.cicleImage.center = CGPointMake(x, self.cicleImage.center.y); } completion:nil]; [UIView animateWithDuration:0.4 delay:0.6 options:0 animations:^{ CGFloat x; x += self.view.bounds.size.width; self.userNameText.center = CGPointMake(x, self.userNameText.center.y); } completion:nil]; [UIView animateWithDuration:0.4 delay:0.6 options:0 animations:^{ CGFloat x; x += self.view.bounds.size.width; self.passwordText.center = CGPointMake(x, self.passwordText.center.y); } completion:nil]; [UIView animateWithDuration:0.4 delay:0.8 options:0 animations:^{ CGFloat x; x += self.view.bounds.size.width; self.login.center = CGPointMake(x, self.login.center.y); } completion:nil]; } - (IBAction)loginBtnClick:(id)sender { [self.login addSubview:self.spinner]; self.spinner.frame = CGRectMake(12, 12, self.spinner.frame.size.width, self.spinner.frame.size.height); [self.spinner startAnimating]; [UIView transitionWithView:self.wrongView duration:0.3 options:0 animations:^{ self.wrongView.hidden = YES; } completion:nil]; [UIView animateWithDuration:0.3 animations:^{ self.login.center = self.view.center; self.login.transform = CGAffineTransformMakeScale(0.8, 0.8); }completion:^(BOOL finished) { self.login.transform = CGAffineTransformMakeScale(1, 1); [UIView animateWithDuration:1.5 delay:0 options:0 animations:^{ } completion:^(BOOL finished) { [UIView animateWithDuration:0.7 animations:^{ self.login.center = CGPointMake(self.login.center.x, self.login.center.y+90); [self.spinner removeFromSuperview]; }completion:^(BOOL finished) { [UIView transitionWithView:self.wrongView duration:0.3 options:0 animations:^{ self.wrongView.hidden = NO; } completion:nil]; }]; }]; }]; }
仅仅是做了一个效果,其他登录逻辑处理大家再按照需求去完善吧,工程我已经放到了这里
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- Gifski:一个跨平台的高质量 GIF 编码器
- 模仿动画的放大缩小容器
- jQuery 1.9.1源码分析系列(十五)动画处理之缓动动画核心Tween
- Android实现定制返回按钮动画效果的方法
- Android中ViewFlipper的使用及设置动画效果实例详解
- jQuery实现美观的多级动画效果菜单代码
- winform异型不规则界面设计的实现方法
- php判断GIF图片是否为动画的方法
- 在ASP.NET 2.0中操作数据之二十:定制数据修改界面
- jQuery实现动画效果circle实例
- HTML5游戏引擎LTweenLite实现的超帅动画效果(附demo源码下载)
- 浅析JavaScript动画
- js排序动画模拟-插入排序