UITextField的PlaceHolder居中显示

2017-11-28  本文已影响0人  sun_glory

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

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

placeholderLabel.textAlignment = NSTextAlignmentCenter;

placeholderLabel.textColor = [UIColor redColor];

placeholderLabel.font = [UIFont systemFontOfSize:16];

上一篇 下一篇

猜你喜欢

热点阅读