美文网首页
UISearchBar 修改取消按钮文字和设置placehode

UISearchBar 修改取消按钮文字和设置placehode

作者: 郭大侠smile | 来源:发表于2017-08-25 17:37 被阅读116次

[[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 修改取消按钮文字和设置placehode

      本文链接:https://www.haomeiwen.com/subject/ijqpdxtx.html