iOS 怎么获取短信验证码
1个回答
2016-11-10 · 学高端技术就来八维教育
关注
展开全部
// JLRegisterViewController.m
// 短信验证
//
// Created by 袁俊亮 on 15/6/26.
// Copyright (c) 2015年 qiji. All rights reserved.
//
#import "QJRegisterViewController.h"
#import "WXApi.h"
#import <SMS_SDK/SMS_SDK.h>
#define statusBarHeight 20
#define textFieldMargin 10 // 两个输入框之间的间距
#define timeCount 60 //倒计时长
static int count = 0;
@interface QJRegisterViewController()<UIAlertViewDelegate,WXApiDelegate, UITextFieldDelegate>
{
NSTimer* _showRepeatButtonTimer; // 显示重新发送按钮倒计时
NSTimer* _updateTime; // 更新倒计时label
UIAlertView *_notGetSMSAlert; //没有搜到验证码重新发送弹窗
UIAlertView *_backButtonClickAlert; //点击返回按钮弹窗
}
@property(nonatomic, weak) UITextField *telField; //手机号码
@property (nonatomic, weak) UITextField *verifyField; // 验证码
@property (nonatomic, weak) UIButton *loginBtn; //登录按钮
@property(nonatomic,strong) UITextField* areaCodeField; //区号
@property (nonatomic, weak) UIButton *icon; // 头像
@property (nonatomic, weak) NSString *str; // alert提示信息
@property (nonatomic, weak) UIButton *verifyRightView; //获取验证码按钮
@end
@implementation QJRegisterViewController
- (void)viewDidLoad
{
// 配置
_areaCodeField.text=[NSString stringWithFormat:@"+%@",@86];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithName:@"background"]];
// 布局子控件
[self setupSubViews];
}
/**
* 布局子控件
*/
- (void)setupSubViews
{
#warning 这里需要根据图片的大小大小来动态确定各控件的frame。这里还没有设置icon的图片
// 创建LOGO
CGFloat logoX = self.view.width * 0.5 - self.icon.currentBackgroundImage.size.width * 0.5;
CGFloat logoY = 100;
CGFloat logoW = self.icon.currentBackgroundImage.size.width;
CGFloat logoH = self.icon.currentBackgroundImage.size.height;
UIButton *icon = [[UIButton alloc] initWithFrame:CGRectMake(logoX, logoY, logoW, logoH)];
icon.backgroundColor = [UIColor blueColor];
[self.view addSubview:icon];
self.icon = icon;
// 创建手机号码输入框
// 短信验证
//
// Created by 袁俊亮 on 15/6/26.
// Copyright (c) 2015年 qiji. All rights reserved.
//
#import "QJRegisterViewController.h"
#import "WXApi.h"
#import <SMS_SDK/SMS_SDK.h>
#define statusBarHeight 20
#define textFieldMargin 10 // 两个输入框之间的间距
#define timeCount 60 //倒计时长
static int count = 0;
@interface QJRegisterViewController()<UIAlertViewDelegate,WXApiDelegate, UITextFieldDelegate>
{
NSTimer* _showRepeatButtonTimer; // 显示重新发送按钮倒计时
NSTimer* _updateTime; // 更新倒计时label
UIAlertView *_notGetSMSAlert; //没有搜到验证码重新发送弹窗
UIAlertView *_backButtonClickAlert; //点击返回按钮弹窗
}
@property(nonatomic, weak) UITextField *telField; //手机号码
@property (nonatomic, weak) UITextField *verifyField; // 验证码
@property (nonatomic, weak) UIButton *loginBtn; //登录按钮
@property(nonatomic,strong) UITextField* areaCodeField; //区号
@property (nonatomic, weak) UIButton *icon; // 头像
@property (nonatomic, weak) NSString *str; // alert提示信息
@property (nonatomic, weak) UIButton *verifyRightView; //获取验证码按钮
@end
@implementation QJRegisterViewController
- (void)viewDidLoad
{
// 配置
_areaCodeField.text=[NSString stringWithFormat:@"+%@",@86];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithName:@"background"]];
// 布局子控件
[self setupSubViews];
}
/**
* 布局子控件
*/
- (void)setupSubViews
{
#warning 这里需要根据图片的大小大小来动态确定各控件的frame。这里还没有设置icon的图片
// 创建LOGO
CGFloat logoX = self.view.width * 0.5 - self.icon.currentBackgroundImage.size.width * 0.5;
CGFloat logoY = 100;
CGFloat logoW = self.icon.currentBackgroundImage.size.width;
CGFloat logoH = self.icon.currentBackgroundImage.size.height;
UIButton *icon = [[UIButton alloc] initWithFrame:CGRectMake(logoX, logoY, logoW, logoH)];
icon.backgroundColor = [UIColor blueColor];
[self.view addSubview:icon];
self.icon = icon;
// 创建手机号码输入框
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询