step 1 - make a custom text field MyTextField first
@interface MyTextField : UITextField
step 2 - override MyTextField methods as per your requirement
///place holder position
- (CGRect)placeholderRectForBounds:(CGRect)bounds
{
return CGRectInset(bounds, 8, 8);
}
// text position
- (CGRect)textRectForBounds:(CGRect)bounds {
return CGRectInset(bounds, 8,4);
}
// text position while editing
- (CGRect)editingRectForBounds:(CGRect)bounds {
return CGRectInset(bounds, 8, 4);
}
step 3- import MyTextField in your controller class & make object of MyTextField
#import "MyTextField.h"
-(void) viewWillAppear:(BOOL)animated {
MyTextField* textfield1 = [[MyTextField alloc] init];
// and so on
}
now every text field will work as expected.