I'm trying to set the position of my custom UITextField
icon. But when I change the imageView's frame's x and y values, it still places them top left.
Here's the viewWillAppear
method of my custom UITextField
class:
var imageView = UIImageView();
var image = UIImage(named: "user-icon.png");
imageView.image = image;
imageView.frame = CGRectMake(100, 0, 20, 19);
usernameTextField.leftView = imageView;
usernameTextField.leftViewMode = UITextFieldViewMode.Always
Changing the x and y parameters in the CGRectMake
call does nothing.
Any ideas? I've read that this may be caused by the element's AutoLayout feature. But if I remove that in the StoryBoard then XCode warns me about the app not looking great on multiple devices...