iOS placeholder 垂直居中
2016-11-01 本文已影响232人
透支未来
UITextField *searchTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, SCREENWIDTH-70-65, 30)];
searchTextField.placeholder = @"请输入搜索关键字...";
[searchTextField setValue:[UIFont boldSystemFontOfSize:12] forKeyPath:@"_placeholderLabel.font"];
searchTextField.font = [UIFont systemFontOfSize:14];
searchTextField.contentVerticalAlignment= UIControlContentVerticalAlignmentCenter;
searchTextField.backgroundColor = [UIColor whiteColor];
searchTextField.textColor = [UIColor CCHei999];
[searchView addSubview:searchTextField];