【问题标题】:UIAlertController rounded rect textfieldUIAlertController 圆角矩形文本字段
【发布时间】:2015-06-08 21:14:39
【问题描述】:

我在为 UIAlertController 设置文本字段时遇到了一些问题。

我正在使用此代码向alertcontroller 添加一个四舍五入的textfield

[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
  textField.placeholder = @"placeholder";
  textField.borderStyle = UITextBorderStyleRoundedRect;
}];

但是,结果是这样的:

如何去除外边框背景色?所以看起来就像他们在本教程中所拥有的:http://useyourloaf.com/blog/2014/09/05/uialertcontroller-changes-in-ios-8.html

谢谢!

【问题讨论】:

    标签: ios uitextfield uialertview uialertcontroller


    【解决方案1】:

    试试

    for textField in alertController.textFields! {
        if let container = textField.superview, let effectView = container.superview?.subviews.first where effectView is UIVisualEffectView {
           container.backgroundColor = UIColor.clearColor()
           effectView.removeFromSuperview()
        }
    }
    

    【讨论】:

      【解决方案2】:

      尝试将 UItextView 的背景颜色设置为 [UIColor clearColor]

      【讨论】:

        猜你喜欢
        • 2010-12-21
        • 1970-01-01
        • 1970-01-01
        • 2021-11-14
        • 2010-11-16
        • 2023-03-28
        • 2022-11-22
        • 1970-01-01
        • 2010-12-14
        相关资源
        最近更新 更多