UISearchBar 修改取消按钮文字和设置placehoder文字大小

[[UIBarButtonItem appearanceWhenContainedIn: [UISearchBar class], nil] setTitle:@"取消"];

NSDictionary *placeholderAttributes = @{
                                        NSForegroundColorAttributeName: [UIColor redColor],
                                        NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:15],
                                        };

NSAttributedString *attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"搜索吧小屁孩"
                                                                            attributes:placeholderAttributes];

[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setAttributedPlaceholder:attributedPlaceholder];

你可能感兴趣的:(UISearchBar 修改取消按钮文字和设置placehoder文字大小)