IOS 仿某某获取验证码方式,xib+自动布局实现
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了IOS 仿某某获取验证码方式,xib+自动布局实现,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2062字,纯文字阅读大概需要3分钟。
内容图文
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 {
return120;
}
/**
* 可以在这个方法里面做一些网络请求操作,比如说点击重新获取验证码,
* 成功后调用 [codeVc startTimer],开始倒计时,进行新一轮的验证码验证。
*/
- (void)getCodeButton:(GetCodeViewController *)codeVc {
[codeVc startTimer];
}
- (BOOL)isStart {
returnNO;
}
- (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及以上。
效果图
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/tangxianhai/article/details/47750097
内容总结
以上是互联网集市为您收集整理的IOS 仿某某获取验证码方式,xib+自动布局实现全部内容,希望文章能够帮你解决IOS 仿某某获取验证码方式,xib+自动布局实现所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。