ACSPinKit 1.1.0

ACSPinKit 1.1.0

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
Released最新版本2016年10月

Orlando Schaefer 维护。



ACSPinKit 1.1.0

试用它!

要运行示例项目,只需输入 pod try ACSPinKit

需求

  • 最小目标 iOS 7

功能

  • 创建一位码
  • 验证一位码
  • 更改一位码
  • 自定义标题、颜色和图像
  • 全屏验证控制器
  • 支持指纹识别
  • 非常模块化的代码设计
  • 支持 iPhone 和 iPad

屏幕截图



ACS ACS ACS



入门

为入门,只需使用给定的用户、服务和访问组初始化一位控制器。所有具有相同值的一位控制器实例共享同一个一位 '域'。

    self.pinController = [[ACSPinController alloc] initWithPinServiceName:@"testservice" pinUserName:@"testuser" accessGroup:@"accesstest" delegate:self];
    self.pinController.retriesMax = 5;
    // Validation block for pin controller to check if entered pin is valid.
    self.pinController.validationBlock = ^(NSString *pin) {
        // Check if 'pin' unlocks a vault or something similar...
    };

retriesMax 表示用户可以尝试验证一位码的次数。同一一位 '域' 中的所有一位控制器实例共享此计数。因此,我们可以确保计数减量...即使我们在其他应用程序中(通过 AppGroups 和 Keychain Access groups)使用相同的一位 '域'。

如果您提供 validationBlock,则一位控制器不会将创建的延长一存入密钥链。因此,您必须手动将其存储(使用 storePin: 消息)。如果您想使用指纹识别,您必须确保您的位码存储在密钥链中。

设置好一位控制器后,只需执行以下用法之一:

创建 PIN

    [self.pinController presentCreateControllerFromViewController:self];

验证 PIN

    [self.pinController presentVerifyControllerFromViewController:self];

更改 PIN

    [self.pinController presentChangeControllerFromViewController:self];

验证 PIN(全屏样式,带圆形按钮)

    UIViewController *pinController = [self.pinController verifyControllerFullscreenForCustomPresentationUsingTouchID:useTouchID];
    // Present the pinController however you want - Maybe as rootViewController of the window?

位控制器还提供了一个用于测试指纹识别是否可用的方法

    NSError *error = nil;
    BOOL useTouchID = [self.pinController touchIDAvailable:&error]
    // Present the pinController however you want - Maybe as rootViewController of the window?

代理方法

/**
This method is called after the pin code was changed successfully.
*/
- (void)pinChangeController:(UIViewController *)pinChangeController didChangePin:(NSString *)pin;
/**
 This method is called after the pin code was created successfully.
*/
- (void)pinCreateController:(UIViewController *)pinCreateController didCreatePin:(NSString *)pin;
/**
 This method is called after the pin code was verified successfully.
*/
- (void)pinController:(UIViewController *)pinController didVerifyPin:(NSString *)pin;
/**
 This method is called after the pin code was entered wrong. If there is only one retry left the lastRetry property is YES.
*/
- (void)pinControllerDidEnterWrongPin:(UIViewController *)pinController lastRetry:(BOOL)lastRetry;
/**
This method is called if the user reached the maximum number of attempts for entering the pin code. This means that the user could not
be verified and you should react properly to that event (e.g. logout user)
*/
- (void)pinControllerCouldNotVerifyPin:(UIViewController *)pinController;
/**
This method is called after touch id verification failed. For the user it fallbacks to the normal pin entering mode.
*/
- (void)pinControllerCouldNotVerifyTouchID:(UIViewController *)pinController withError:(NSError *)error;
/**
This message is send if the user selects the cancel button. If you have presented the pin controller manually you have to dismiss it here again.
*/
- (void)pinControllerDidSelectCancel:(UIViewController *)pinController;
/**
If the user selects the custom action button. Do whatever you want (e.g. show a menu)
*/
- (void)pinController:(UIViewController *)pinController didSelectCustomActionButton:(UIButton *)actionButton;

自定义

通过self.pinController.pinCustomizer,您可以访问以下属性。

/**
 A property for providing a custom title image for the fullscreen controller (e.g. company logo)
 */
@property (nonatomic, strong) UIImage *titleImage;
/**
 A property for providing a custom action button image for the fullscreen controller (e.g. a burger button icon)
 */
@property (nonatomic, strong) UIImage *actionButtonImage;
/**
 A property for providing a custom action button title for the fullscreen controller (e.g. 'Menu')
 */
@property (nonatomic, strong) NSString *actionButtonString;
/**
 The background color of the display (upper part of controller)
 */
@property (nonatomic, strong) UIColor *displayBackgroundColor;
/**
 The color of the title text / prompt text
 */
@property (nonatomic, strong) UIColor *headerTitleColor;
/**
 The color of the placeholder dots of the passcode
 */
@property (nonatomic, strong) UIColor *passcodeDotsColor;
/**
 The color of the alert text that appear when entering a wrong pin
 */
@property (nonatomic, strong) UIColor *alertTextColor;
/**
 The background color of the keypad
 */
@property (nonatomic, strong) UIColor *keyboardBackgroundColor;
/**
 The color of the keypad buttons
 */
@property (nonatomic, strong) UIColor *keyboardTintColor;
/**
 The color of the keypad button titles
 */
@property (nonatomic, strong) UIColor *keyboardTitleColor;
/**
 The highlight color of the keypad buttons (when touching them)
 */
@property (nonatomic, strong) UIColor *keyboardHighlightColor;
/**
 The reason text that appear when using touch id.
 */
@property (nonatomic, strong) NSString *touchIDReasonText;
/**
 The fallback title of the button after touch id fails.
 */
@property (nonatomic, strong) NSString *touchIDFallbackTitle;

作者

arconsis IT-Solutions GmbH [email protected]

许可证

MIT许可证(MIT)

版权所有 © 2015 arconsis IT-Solutions GmbH [email protected]

特此授予任何获得本软件及其相关文档资料(以下简称“软件”)副本的个人无限制使用本软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可以及/或出售软件副本的权利,并允许软件接收者进行上述行为,前提是遵守以下条件

上述版权声明和许可声明必须包含在软件的副本或任何实质部分中。

软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任承担责任,无论是基于合同、侵权或其他原因,无论是在软件本身、使用或与软件相关的环境下产生的。