類似 iOS 的解鎖應用:THPinViewController
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 {}
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!


