TvOSPinKeyboard 2.0.4

TvOSPinKeyboard 2.0.4

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2021 年 5 月
SPM支持 SPM

David Corderoclaudia glombVitalij Dadaschjanz 维护。



 
依赖关系
FocusTvButton~> 3.0.0
Cartography~> 4.0.0
 

  • Zattoo

TvOSPinKeyboard

适用于 tvOS 的 PIN 键盘

描述

TvOSPinKeyboard 是一个视图控制器,它允许轻松地在 tvOS 中请求 PIN 码。

要求

  • tvOS 9.0+
  • Xcode 11

安装

Cocoapods

要使用 CocoaPods 将 TvOSPinKeyboard 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它

source 'https://github.com/CocoaPods/Specs.git'
platform :tvos, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'TvOSPinKeyboard', '~> 2.0.1'
end

使用方法

您只需创建一个 TvOSPinViewController 的实例,并在屏幕上展示它。键盘输入的密码将通过 TvOSPinKeyboardDelegate 返回。

import UIKit
import TvOSPinKeyboard

class ViewController: UIViewController, TvOSPinKeyboardViewDelegate {

    @IBOutlet private weak var pinLabel: UILabel!

    @IBAction func pinButtonWasPressed(_ sender: Any) {
        let pinKeyboard = TvOSPinKeyboardViewController(withTitle: "Introduce your PIN", message: "A pin code is required")
        pinKeyboard.delegate = self

        present(pinKeyboard, animated: true, completion: nil)
    }

    // MARK: - TvOSPinKeyboardViewDelegate

    func pinKeyboardDidEndEditing(pinCode: String) {
        pinLabel.text = "Your Pin Code is: " + pinCode
    }
}

自定义

除了标题和副标题外,TvOSPinKeyboard 还提供广泛的自定义选项

可自定义属性

  • backgroundView
  • pinLength
  • titleFont
  • titleColor
  • subtitleFont
  • subtitleColor
  • pinFont
  • pinColor
  • pinBackgroundColor
  • numpadButtons
  • numpadFont
  • deleteButtonTitle
  • deleteButtonFont
  • buttonsNormalTitleColor
  • buttonsFocusedTitleColor
  • buttonsFocusedBackgroundColor
  • buttonsFocusedBackgroundEndColor
  • buttonsNormalBackgroundColor
  • buttonsNormalBackgroundEndColor