簡體   English   中英

UIAlertController圓角矩形文本字段

[英]UIAlertController rounded rect textfield

我在設置UIAlertController的文本字段時遇到了一些問題。

我正在使用此代碼向alertcontroller添加一個舍入的textfield alertcontroller

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

但結果如下:

在此輸入圖像描述

如何刪除外邊框背景顏色 所以它看起來像他們在本教程中所擁有的: http//useyourloaf.com/blog/2014/09/05/uialertcontroller-changes-in-ios-8.html

謝謝!

嘗試將UItextView的背景顏色設置為[UIColor clearColor]

嘗試

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM