UITextField的PlaceHolder居中显示

UITextField的PlaceHolder居中显示,可以直接访问到UITextField的placeholderLabel进行操作:

UILabel * placeholderLabel = [self.searchTextField valueForKey:@"_placeholderLabel"];

placeholderLabel.textAlignment = NSTextAlignmentCenter;

placeholderLabel.textColor = [UIColor redColor];

placeholderLabel.font = [UIFont systemFontOfSize:16];

你可能感兴趣的:(UITextField的PlaceHolder居中显示)