欢迎光临
我们一直在努力

MRGestureUnlock 手势解锁

建站超值云服务器,限时71元/月

MRGestureUnlock 手势解锁

项目介绍:

MRGestureUnlock  使用贝塞尔曲线实现手势解锁   https://github.com/Andrew554/MRGestureUnlock

ViewController 主要代码如下:
[Objective-C] 查看源文件 复制代码

#import "ViewController.h"
#import "MRGestureBgView.h"
#import "MRScuuessViewController.h"
#import "MRGestureView.h"
#import "MRGesture.h"

@interface ViewController ()<MRGestureViewDelegate>

/** 背景控件 */
@property(nonatomic, strong)MRGestureBgView *bgView;

/** 手势解锁控件 */
@property(nonatomic, strong)MRGestureView *gestureView;

@end

@implementation ViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    // 初始化
    [self setupGesture];
}


/**
 *        @brief        初始化手势相关控件
 */
- (void)setupGesture {
    
    // 将控制器的view设置为手势背景图的view
    self.bgView = [[MRGestureBgView alloc] init];
    
    self.bgView.frame = self.view.bounds;
    
    self.view = self.bgView;
    
    // 添加手势视图
    self.gestureView = [[MRGestureView alloc] init];
    
    self.gestureView.delegate = self;
    
    MRGesture *gesture = [[MRGesture alloc] init];
    
    // 设置密码
    gesture.password = @"147895";
    
    self.gestureView.gesture = gesture;
    
    self.gestureView.frame = CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height);
    
    [self.view addSubview:self.gestureView];
    
}

#pragma mark - <MRGestureViewDelegate>

- (void)gestureViewUnlockSuccess:(MRGestureView *)gestureView {
    
    [self presentViewController:[[MRScuuessViewController alloc] init] animated:YES completion:nil];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

DEMO 直接下载:

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » MRGestureUnlock 手势解锁
分享到: 更多 (0)