前言:如果頁面顯示不完整或圖片看不了還請移步:簡書
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); }
效果:
【SJPullDownMenu】框架github下載地址:https://github.com/shaojianye/SJGestureUnlock.git
【SJPullDownMenu】框架碼雲下載地址:https://git.oschina.net/miaomiaoshen/SJGestureUnlock.git