I have UITextField of which I've added an image.
Everything looks good, except that the text starts from zero X-coordinate, but I want it to start after 5 pixels in text field.
I have UITextField of which I've added an image.
Everything looks good, except that the text starts from zero X-coordinate, but I want it to start after 5 pixels in text field.
put a left view into your text filed as such :
    textField.layer.cornerRadius = 5.0;
    UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, textField.frame.size.height)];
    textField.leftView = paddingView;
    [paddingView release];
    textField.leftViewMode = UITextFieldViewModeAlways;
 
    
    Simple way to do this.
Checkout attached image for a detailed knowledge

Enjoy Programming !
 
    
    Simplest Answer :
1) Take one UIImageView. Add that Image for UITextField in UIImageView.
2) Add UITextField with "No Border" above that UIImageView (5 Pixels Right on that UIImageView).
GoodLuck !!!
 
    
    Try to use this one
  UIImageView *imageView = [[UIImageView alloc] init];
    // add 5 (width) pixel for your space
    imageView.frame = CGRectMake(0,0 ,5, txtFld.frame.size.height);
    txtFld.leftViewMode = UITextFieldViewModeAlways;
    txtFld.leftView = imageView;
And see in this image for more info.

