ios - 并非所有 Stripe 占位符同时在我的屏幕上可见

标签 ios swift stripe-payments placeholder

您好,我尝试在屏幕上同时显示所有三个占位符,在更改 strip 付款文本字段名称中的占位符名称后STPPaymentCardTextField

我在 Storyboard中给占位符命名,如下所示

enter image description here

但是当我在模拟器中运行程序时,我得到以下输出:

enter image description here

当我尝试输入在文本字段中选择的详细信息时,只有它会显示占位符,例如

enter image description here

我想显示 4242424242424242 的占位符卡号替换如何解决此问题。

  @IBOutlet weak var cardview: STPPaymentCardTextField!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.  
        cardview.numberPlaceholder = "CardNumber"
        cardview.cvcPlaceholder = "CVC"
        cardview.expirationPlaceholder = "MM/YY"
    }*

最佳答案

首先,您不需要在 Storyboard 或 viewDidLoad 中设置 MM/YY 和 CVC 的自定义占位符,因为它们已经是默认占位符,请参阅 STPPaymentCardTextField.h 上的代码引用:

/**
 The placeholder for the expiration field. Defaults to @"MM/YY".
 */
@property (nonatomic, copy, nullable) IBInspectable NSString *expirationPlaceholder;

/**
 The placeholder for the cvc field. Defaults to @"CVC".
 */
@property (nonatomic, copy, nullable) IBInspectable NSString *cvcPlaceholder;

关于您无法在一个屏幕中直接看到所有三个占位符的问题,如 from the authors :

This is intentional. If you type a valid credit card number into the CC field, it will slide away to reveal the expiration and CVC fields.

在较大的屏幕(例如处于横向模式的 iPad)中,这三个屏幕通常同时可见,因为它们可以一起显示在屏幕中。

关于ios - 并非所有 Stripe 占位符同时在我的屏幕上可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55651060/

相关文章:

ios - 使用Xcode5.1 beta5还是使用xcode 5.0.2部署?

ios - iOS 上的 PlayReady DRM : Can you copy the decrypted video image to your own GL Context?

ios - SCNMatrix4 的前两列是什么

swift - Swift 创建 Outlet 时 UISwitch 无法正确执行

javascript - Stripe Checkout.js token 回调是否会阻塞,直到付款处理完毕?

javascript - 无法使用 Stripe 创建信用卡 token (django)

iphone - 是 - [UIView (MyOwnCategory) drawRect :] never called on 3. 1.3?

iphone - Flickr SDK 未转换为 ARC

ios - 'Dictionary' 专门用于太少的类型参数(有 1 个,但预期有 2 个)Swift

node.js - 更新 JSON 数组特定字符串