How can I change the size of a UITextField?

47 Views Asked by At

I want to change the size of the UITextField programmatically.

Actually what I want to do exactly is this UIAlertView inside I have a UITextField. I want to increase the size of this UITextField.

Image:

enter image description here

The code I want is something like this.

textField.preferredContentSize = CGSize(width: 250, height: 300)

But it cannot be used this way.

1

There are 1 best solutions below

0
Venus On BEST ANSWER

I am sorry, you can't change the UITextField size directly.

If you want to customize the content of the AlertView like UITextField, you should create a custom UIView and present it modally.

It's same to UIAlertView and UIAlertViewController.