In my iOS project, i added an image to the right of text field. It leaned on borders at all.
Then i searched and find this topic and used TTillage's solution. It became better, but still leaned on top and bottom borders.
Finally i changed the frame of my image, however pulling inside from right border was not working at this point. My final view is:
I want this little image to be a bit away from borders and not stretched (if i do second version with third, it gets stretched). Is there a way for this? My code:
myImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage.png"]];
myImage.frame = CGRectMake(30.0, 0.0, self.textField.frame.size.height-5.0, self.textField.frame.size.height-5.0);
//myImage.contentMode = UIViewContentModeCenter;
self.textField.rightViewMode = UITextFieldViewModeUnlessEditing;
self.textField.rightView = myImage;
Thank you.