测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2017年4月 |
由_ivanC--description=macbook pro维护。
ICPatternLock是您应用访问的屏幕锁。对大多数人来说,它既熟悉又直观明了,因为图案更容易记住。更重要的是,它也方便开发人员使用和扩展。
要运行示例项目,请克隆仓库,并首先从示例目录中运行pod install
。
ICPatternLock可通过CocoaPods使用。要安装它,只需将以下行添加到您的Podfile中
pod "ICPatternLock"
如果您不太关注视图显示和一些交互,只需使用ICPatternLockManager
来显示图案锁并接收结果。当然,您可以通过这种方式自定义GUI(例如颜色、文本和首选项)。您所需要做的只是在自己的逻辑块中运行逻辑。请查看示例项目
以体验这一点。
if ([ICPatternLockManager isPatternSetted])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hint"
message:@"Pattern already setted"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
else
{
[ICPatternLockManager showSettingPatternLock:self
animated:YES
successBlock:^(ICPatternLockViewController *controller){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[controller dismissViewControllerAnimated:YES completion:nil];
});
}];
}
[ICPatternLockManager showVerifyPatternLock:self
animated:YES
forgetPwdBlock:^(ICPatternLockViewController *controller){
NSLog(@"OMG~ forgot my pattern!~");
}
successBlock:^(ICPatternLockViewController *controller){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[controller dismissViewControllerAnimated:YES completion:nil];
});
}];
[ICPatternLockManager showModifyPatternLock:self
animated:YES
successBlock:^(ICPatternLockViewController *controller) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[controller dismissViewControllerAnimated:YES completion:nil];
});
}];
使用以下API自定义您的资源(文本显示和颜色)及首选项(例如节点大小、密钥表)。所有密钥都在PLPreferencesKeyDef.h
、PLResourceTextKeyDef.h
、PLResourceColorKeyDef.h
中定义。您可以更改所有值,也可以按需更改其中之一。
#pragma mark - Resource Bridge
+ (void)loadTextResource:(NSDictionary *)textInfo;
+ (void)loadColorResource:(NSDictionary *)colorInfo;
#pragma mark - Preferences
- (void)setPreferencesValue:(id)value forKey:(NSString *)key;
#pragma mark - PatternHandler
+ (void)setCustomizedPatternHandler:(id<ICPatternHandlerProtocol>)handler;
如果您想将其组合到自己的逻辑中,可以直接使用ICPatternLockViewController
,它有足够多的API供用户使用。此外,您还可以使用ICPatternLockView
来达到其他目标,想象是无边无际的!
_ivanC
ICPatternLock可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。