0

In my iOS project, i added an image to the right of text field. It leaned on borders at all. enter image description here

Then i searched and find this topic and used TTillage's solution. It became better, but still leaned on top and bottom borders. enter image description here

Finally i changed the frame of my image, however pulling inside from right border was not working at this point. My final view is: enter image description here

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.

Community
  • 1
  • 1
anyName
  • 113
  • 1
  • 2
  • 13

0 Answers0