前言:如果頁面顯示不完整或圖片看不了還請移步:簡書
SJGestureUnlock.h
-
常用自定義屬性
@interface SJGestureUnlock : UIView @property (nonatomic, weak) id<SJGestureUnlockDelegate> delegate; /** * 默認(rèn)圖片 */ @property (nonatomic, strong) UIImage *image; /** * 高亮圖片 */ @property (nonatomic, strong) UIImage *selectedImage; /** * 連接線的顏色 */ @property (nonatomic, strong) UIColor *lineColor; /** * 連接線寬度 */ @property (nonatomic, assign) CGFloat lineWidth; /** * 實(shí)例化手勢解鎖 */ + (instancetype)gestureUnlockWithFrame:(CGRect)frame; @end
-
代理方法
@protocol SJGestureUnlockDelegate <NSObject> /** * 返回對應(yīng)的密碼 */ - (void)gestureUnlock:(SJGestureUnlock *)GestureUnlock result:(NSInteger)result; @end
SJGestureUnlock使用
-
實(shí)例化
// 實(shí)例化手勢解鎖 SJGestureUnlock *gestureUnlock = [SJGestureUnlock gestureUnlockWithFrame:CGRectMake(unlockX, unlockY, unlockW, unlockH)]; gestureUnlock.delegate = self; [self.view addSubview:gestureUnlock];
-
實(shí)現(xiàn)代理方法
/** * 返回記錄的結(jié)果 * * @param GestureUnlock 當(dāng)前手勢解鎖View * @param result 結(jié)果 */ - (void)gestureUnlock:(SJGestureUnlock *)GestureUnlock result:(NSInteger)result { NSLog(@"結(jié)果:%ld", result); }
效果:
效果.gif
【SJPullDownMenu】框架github下載地址:https://github.com/shaojianye/SJGestureUnlock.git
【SJPullDownMenu】框架碼云下載地址:https://git.oschina.net/miaomiaoshen/SJGestureUnlock.git