SJGestureUnlock快速集成手勢解鎖

前言:如果頁面顯示不完整或圖片看不了還請移步:簡書

SJGestureUnlock.h


  • 常用自定義屬性

        @interface SJGestureUnlock : UIView
    
        @property (nonatomic, weak) id<SJGestureUnlockDelegate> delegate;
        /**
        *  默認圖片
        */
        @property (nonatomic, strong) UIImage *image;
        /**
        *  高亮圖片
        */
        @property (nonatomic, strong) UIImage *selectedImage;
        /**
         *  連接線的顏色
        */
        @property (nonatomic, strong) UIColor *lineColor;
        /**
        *  連接線寬度
        */
        @property (nonatomic, assign) CGFloat lineWidth;
    
        /**
        *  實例化手勢解鎖
        */
        + (instancetype)gestureUnlockWithFrame:(CGRect)frame;
    
        @end
    
  • 代理方法

        @protocol SJGestureUnlockDelegate <NSObject>
    
        /**
         *  返回對應的密碼
        */
        - (void)gestureUnlock:(SJGestureUnlock *)GestureUnlock result:(NSInteger)result;
    
        @end
    

SJGestureUnlock使用

  • 實例化

        // 實例化手勢解鎖
        SJGestureUnlock *gestureUnlock = [SJGestureUnlock gestureUnlockWithFrame:CGRectMake(unlockX, unlockY, unlockW, unlockH)];
        gestureUnlock.delegate = self;
        [self.view addSubview:gestureUnlock];
    
  • 實現代理方法

        /**
         *  返回記錄的結果
        *
        *  @param GestureUnlock 當前手勢解鎖View
        *  @param result        結果
        */
        - (void)gestureUnlock:(SJGestureUnlock *)GestureUnlock result:(NSInteger)result {
    
            NSLog(@"結果:%ld", result);
        }
    

效果:
效果.gif

【SJPullDownMenu】框架github下載地址:https://github.com/shaojianye/SJGestureUnlock.git
【SJPullDownMenu】框架碼雲下載地址:https://git.oschina.net/miaomiaoshen/SJGestureUnlock.git

發佈了80 篇原創文章 · 獲贊 249 · 訪問量 18萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章