UIAlertController圆角矩形文本框

7

我在设置UIAlertControllertextfield时遇到了一些问题。

我正在使用以下代码向alertcontroller添加一个圆角textfield

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

然而,结果是这样的: enter image description here 我该如何去掉外边框和背景颜色?让它看起来像他们在这个教程中所展示的:http://useyourloaf.com/blog/2014/09/05/uialertcontroller-changes-in-ios-8.html
谢谢!
2个回答

0

尝试

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()
    }
}

-1
尝试将UITextView的背景颜色设置为[UIColor clearColor]。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接