类似 iOS 的解锁应用:THPinViewController

jopen 10年前

THPinViewController 实现了一个用于iOS7风格的数据锁定码用户界面,也可以用于输入数字密码。类似 iOS 的解锁应用。

特性:
  • Has iPhone portrait and iPad portrait and landscape layouts
  • Supports variable PIN lengths
  • Buttons can show numbers and letters or only numbers
  • Background and tint colors as well as text and color of the prompt can be customized
  • Supports solid color and translucent/blurred background

 

用法    THPinViewController *pinViewController = [[THPinViewController alloc] initWithDelegate:self];  pinViewController.promptTitle = @"Enter PIN";  pinViewController.promptColor = [UIColor darkTextColor];  pinViewController.view.tintColor = [UIColor darkTextColor];  pinViewController.hideLetters = YES;    // for a solid color background, use this:  pinViewController.backgroundColor = [UIColor whiteColor];    // for a translucent background, use this:  self.view.tag = THPinViewControllerContentViewTag;  self.modalPresentationStyle = UIModalPresentationCurrentContext;  pinViewController.translucentBackground = YES;    [self presentViewController:pinViewController animated:YES completion:nil];    // mandatory delegate methods    - (NSUInteger)pinLengthForPinViewController:(THPinViewController *)pinViewController  {      return 4;  }    - (BOOL)pinViewController:(THPinViewController *)pinViewController isPinValid:(NSString *)pin  {      if ([pin isEqualToString:self.correctPin]) {          return YES;      } else {          self.remainingPinEntries--;          return NO;      }  }    - (BOOL)userCanRetryInPinViewController:(THPinViewController *)pinViewController  {      return (self.remainingPinEntries > 0);  }    // optional delegate methods    - (void)incorrectPinEnteredInPinViewController:(THPinViewController *)pinViewController {}  - (void)pinViewControllerWillDismissAfterPinEntryWasSuccessful:(THPinViewController *)pinViewController {}  - (void)pinViewControllerDidDismissAfterPinEntryWasSuccessful:(THPinViewController *)pinViewController {}  - (void)pinViewControllerWillDismissAfterPinEntryWasUnsuccessful:(THPinViewController *)pinViewController {}  - (void)pinViewControllerDidDismissAfterPinEntryWasUnsuccessful:(THPinViewController *)pinViewController {}  - (void)pinViewControllerWillDismissAfterPinEntryWasCancelled:(THPinViewController *)pinViewController {}  - (void)pinViewControllerDidDismissAfterPinEntryWasCancelled:(THPinViewController *)pinViewController {}

    类似 iOS 的解锁应用:THPinViewController类似 iOS 的解锁应用:THPinViewController类似 iOS 的解锁应用:THPinViewController

    项目主页:http://www.open-open.com/lib/view/home/1402828461294