ESPinEntryView 1.0.1

ESPinEntryView 1.0.1

测试已测试
语言语言 Obj-Cobjective-c
许可证 BSD 许可证
发布最新发布2015年3月

Bas van Kuijck 维护。



 
依赖关系
Masonry~> 0.6
ReactiveCocoa~> 2.4
FXBlurView~> 1.6
 

  • 作者:
  • bvkuijck

iOS7 风格的密码锁。完全可定制。

示例

安装

CocoaPods

pod 'ESPinEntryView', '~> 1.0'

手动安装

以下类有以下依赖关系

使用

ESPinEntryView

#import <ESPinEntryView.h>

ESPinEntryView *entryView = [[ESPinEntryView alloc] initWithFrame:self.view.bounds];
[entryView setBackgroundBlurRadius:15];
[entryView setDelegate:self];
[entryView setBackgroundView:[[UIView alloc] init]];
[entryView.backgroundView setBackgroundColor:[UIColor blueColor]];
[entryView setShowAlphabet:YES];
[entryView setShowCancelButton:YES];
[self.view addSubview:entryView];

ESPinEntryViewController

#import <ESPinEntryViewController.h>

ESPinEntryViewController *viewController = [[ESPinEntryViewController alloc] init];
[viewController setDelegate:self];
[viewController.pinEntryView setBackgroundBlurRadius:15];
[viewController.pinEntryView setBackgroundView:[[UIView alloc] init]];
[viewController.pinEntryView setBackgroundColor:[UIColor blueColor]];
[viewController.pinEntryView setShowAlphabet:YES];
[viewController.pinEntryView setShowCancelButton:YES];
[self presentViewController:viewController animated:YES completion:nil];

委托

- (BOOL)pinEntry:(ESPinEntryView *)pinEntryView isValidCode:(NSString *)code
{
    NSLog(@"Attempt %zd", pinEntryView.attempts);
    return [code isEqualToString:@"1234"];
}

自定义

本地化

  • deleteText:删除按钮中的文本(默认值为 "删除")
  • cancelText:取消按钮中的文本(默认值为 "取消")
  • headerText:提示用户输入密码的顶部文本(默认值为 "输入密码")

外观

  • showCancelButton:当没有输入数字时是否应该显示取消按钮(默认值为 NO)
  • showAlphabet:输入按钮是否应包含字母字符。(默认值 = NO)
  • backgroundView:输入按钮是否应包含字母字符。(默认值为蓝灰色背景)
  • backgroundBlurRadius:应用于背景视图的模糊半径(默认值为 15)
  • backgroundColor:覆盖在 backgroundView 上的背景颜色(默认值为 70% 不透明度的黑色)

验证

  • numberOfDigits:应输入的总数字数。(默认值为 4)
  • attempts:总的尝试次数(只读)
  • code:输入的密码(只读)
  • vibrate:当提供错误输入时设备是否振动(默认值 = YES)

通用

  • 委托