Center align placeholder in textfield
问题 I know this question been asked many times but as drawinrect deprecated and I need this in ios 8.As I have a textfield and I need the placeholder in center align and rest of the test left align.Please help me out. 回答1: Create and connect IBOutlet to your textField. In YourViewController.m @interface YourViewController () <UITextFieldDelegate> @property (weak, nonatomic) IBOutlet UITextField *txt; In your viewDidLoad self.txt.delegate=self; self.txt.textAlignment=NSTextAlignmentCenter; Write