Der folgende Code ist von der WWDC 2015 Session 702 Apple-Pay Innerhalb Apps - Emporium: Eine einfache Shopping-Erlebnis mit Apple PayWie erstellt man PKPaymentButton in IB?
if PKPaymentAuthorizationViewController.canMakePaymentsUsingNetworks(ProductTableViewController.supportedNetworks) {
let button = PKPaymentButton(type: .Buy, style: .Black)
button.addTarget(self, action: #selector(ProductTableViewController.applePayButtonPressed), forControlEvents: .TouchUpInside)
button.center = applePayView.center
button.autoresizingMask = [.FlexibleLeftMargin, .FlexibleRightMargin]
applePayView.addSubview(button)
}
Ich frage mich, ob wir auf diese Schaltfläche in IB schaffen könnte.
Fügen Sie einfach Ihre Schaltfläche zur Unterklasse von PKPaymentButton –
Was ist mit den früheren Versionen, die Apple Pay, aber nicht diese Schaltfläche unterstützen? Bedeutung Wie würden Sie eine Schaltfläche in Xib initialisieren, die PKCAptionButton bedingt unterklassifiziert? –