IOS 仿某某获取验证码方式,xib+自动布局实现
2015-08-18 12:10
741 查看
GetCodeViewController
仿某某获取验证码,并验证方式。提供很多自定义接口,高度自定义。也可以自己更改源代码,界面用xib文件,加自动布局实现,直观易懂。运行项目,请先cd到该目录后,pod update一下,即可运行,因为用到了POP动画库。
用法
将 项目中 popCodeViewController 整个文件夹拖到你的项目里面。导入依赖库POP动画库
自定义控制器中,导入GetCodeViewController、PresentingAnimator、DismissingAnimator类
自定义控制器中,实现以下方法
#pragma mark - GetCodeViewDelegate Method - (NSString *)titleForCodeView { return [NSString stringWithFormat:@"验证码已发送至您手机187*****1234"]; } - (NSString *)titleForCodeButton { return @"获取验证码"; } - (NSInteger)timeCode { return 120; } /** * 可以在这个方法里面做一些网络请求操作,比如说点击重新获取验证码, * 成功后调用 [codeVc startTimer],开始倒计时,进行新一轮的验证码验证。 */ - (void)getCodeButton:(GetCodeViewController *)codeVc { [codeVc startTimer]; } - (BOOL)isStart { return NO; } - (void)cancelButton:(GetCodeViewController *)codeVc { [codeVc dismissViewControllerAnimated:YES completion:nil]; } - (void)sureButton:(GetCodeViewController *)codeVc { NSLog(@"确 定"); } #pragma mark - UIViewControllerTransitioningDelegate - (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source { return [PresentingAnimator new]; } - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed { return [DismissingAnimator new]; }
5.调用,实现以下代码即可
GetCodeViewController *getCodeViewController = [GetCodeViewController new]; getCodeViewController.delegate = self; getCodeViewController.transitioningDelegate = self; getCodeViewController.modalPresentationStyle = UIModalPresentationCustom; [self presentViewController:getCodeViewController animated:YES completion:NULL];
版本
支持iOS7.0及以上。效果图
github地址:https://github.com/804145113/GetCodeViewController
相关文章推荐
- java自动生成验证码插件-kaptcha
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- Gifski:一个跨平台的高质量 GIF 编码器
- 模仿动画的放大缩小容器
- 如何识别高级的验证码的技术总结第1/4页
- LCL.VBS 病毒源代码
- winform异型不规则界面设计的实现方法
- PHP 验证码不显示只有一个小红叉的解决方法
- php判断GIF图片是否为动画的方法
- php查看网页源代码的方法
- asp汉字中文图片验证码
- PHP实现简单汉字验证码
- php 验证码制作(网树注释思想)
- C#验证码识别基础方法实例分析
- jQuery实现动画效果circle实例
- 浅析JavaScript动画
- js排序动画模拟-插入排序
- javascript点击才出现验证码
- javascript+HTML5的Canvas实现Lab单车动画效果
- node.js WEB开发中图片验证码的实现方法