iOS placeholder 垂直居中

 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];

你可能感兴趣的:(iOS placeholder 垂直居中)