UIAlertController Rounded Rectangular Text Box

I am having problems setting up a text box for my UIAlertController .

I use this code to add a rounded textfield to an alertcontroller :

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

However, the result is the following:

enter image description here

How to remove the outer border and background color? So it looks like they have in this lesson: http://useyourloaf.com/blog/2014/09/05/uialertcontroller-changes-in-ios-8.html .

Thanks!

+6
source share
2 answers

try setting the background color of the UItextView to [UIColor clearColor]

+1
source

to try

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

Source: https://habr.com/ru/post/988740/


All Articles