干iOS开发快两年了,才想起来写写技术博客,反射弧有点儿长啊哈哈!!!技术大牛请绕行,小弟不才,勿喷。
废话不多说,直切主题:其实扫二维码实现pc免登陆的业务逻辑很简单,我是仿淘宝的界面实现的,扫完码的页面如下,如果超过十秒,则跳入失效界面


封装了个View
下面是.h中的公共方法
@class LYComputerLogInView;
@protocol LYComputerLogInViewDelegate
@optional
//登陆代理事件- (void)logInClick;
//退出点击事件- (void)lyComputerLogInViewDidDismissed:(LYComputerLogInView *)computerLogInView;
@end
@interface LYComputerLogInView : UIView
/** * 图片 */
@property (nonatomic,strong,readonly)UIImageView *headImageView;
/** * 标题 */
@property (nonatomic,strong,readonly)UILabel *titleLabel;
/** * 描述 */
@property (nonatomic,strong,readonly)UILabel *descripLabel;
/** * 登录按钮 */
@property (nonatomic,strong,readonly)UIButton *logInbtn;
/** * 取消或者重新扫描按钮 */
@property (nonatomic,strong,readonly)UIButton *clickBtn;
@property (nonatomic,weak)id 《LYComputerLogInViewDelegate》delegate;
/**
* 显示方法
*
* @param rect 传尺寸
*/
- (void)showInRect:(CGRect)rect withAnimation:(BOOL)animation;
/**
* 消失方法
*/
- (void)dismiss;
/**
* 类方法
*
* @return computerView
*/
+(instancetype)computerLogInView;
/**
* 初始化方法
*
* @return computerView
*/
-(instancetype)initComputerLogInView;
@end
具体代码下载地址:https://github.com/liyang0099/computerLogIn2
网友评论