目前最全面最高仿支付寶的手勢解鎖:PCGestureUnlock

jopen 9年前發布 | 22K 次閱讀 iOS開發 移動開發 PCGestureUnlock

目前最全面最高仿支付寶的手勢解鎖,而且提供方法進行參數修改,能解決項目開發中所有手勢解鎖的開發


宣言:不僅僅是支付寶手勢解鎖,它很好很強大~

框架基礎:全面實現支付寶手勢解鎖,包括各種細節!!!(具體見gif圖片)

框架目標:打造主流手勢解鎖終結者,簡單易用,高度解耦!

框架特點:面向實際項目開發,修改參數(PCCircleViewConst.h文件中)即可實現實際需求

設置密碼:

ABC

細節處理之全方向箭頭

ABC

細節處理之錯誤繪制

ABC

細節處理之跳躍連線

ABC

框架使用說明:

使用前說明:解鎖界面(PCCircleView)可以實例化出特定使用的類型界面,實現以下方法即可 // 初始化方法(設置view的相關類型、參數) - (instancetype)initWithType:(CircleViewType)type clip:(BOOL)clip arrow:(BOOL)arrow; clip代表圓內是否剪切 arrow代表是否有三角箭頭

1.包含框架文件:(FrameWork)

2.在使用到的控制器中實現以下方法:

  - (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view.

 // 解鎖界面  默認clip:YES, arrow:YES
 PCCircleView *lockView = [[PCCircleView alloc] init];  
  lockView.delegate = self;
  self.lockView = lockView;
  [self.view addSubview:lockView];
 }

  #pragma - mark - circleView - delegate
  #pragma mark - circleView - delegate - setting
  - (void)circleView:(PCCircleView *)view type:(CircleViewType)type connectCirclesLessThanNeedWithGesture:(NSString *)gesture
{
 NSString *gestureOne = [PCCircleViewConst getGestureWithKey:gestureOneSaveKey];

  // 看是否存在第一個密碼
 if ([gestureOne length]) {
     NSLog(@"提示再次繪制之前繪制的第一個手勢密碼");
 } else {
     NSLog(@"密碼長度不合法%@", gesture);
 }
 }

  - (void)circleView:(PCCircleView *)view type:(CircleViewType)type didCompleteSetFirstGesture:(NSString *)gesture
{
   NSLog(@"獲得第一個手勢密碼%@", gesture);
   // infoView展示對應選中的圓
}

- (void)circleView:(PCCircleView *)view type:(CircleViewType)type didCompleteSetSecondGesture:(NSString *)gesture result:(BOOL)equal
{
 NSLog(@"獲得第二個手勢密碼%@",gesture);
 if (equal) {
     NSLog(@"兩次手勢匹配!可以進行本地化保存了");

 } else {
     NSLog(@"兩次手勢不匹配!");
 }
  }

#pragma mark - circleView - delegate - login or verify gesture
  - (void)circleView:(PCCircleView *)view type:(CircleViewType)type didCompleteLoginGesture:(NSString *)gesture result:(BOOL)equal
{
    // 此時的type有兩種情況 Login or verify
    if (type == CircleViewTypeLogin) {
       if (equal) {
         NSLog(@"登陸成功!");
       } else {
        NSLog(@"密碼錯誤!");
       }
 } else if (type == CircleViewTypeVerify) {

       if (equal) {
           NSLog(@"驗證成功,跳轉到設置手勢界面");

       } else {
         NSLog(@"原手勢密碼輸入錯誤!");

    }
    }
}

項目主頁:http://www.baiduhome.net/lib/view/home/1434439299786

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!