美文网首页
ios 修改UISearchBae placeholder的颜

ios 修改UISearchBae placeholder的颜

作者: 天上飞的狒狒 | 来源:发表于2023-03-13 16:03 被阅读0次
         UITextField *textfield;
         if (@available(iOS 13.0, *)) {
             textfield = [_searchBar searchTextField];
         } else {
             textfield = [_searchBar valueForKey:@"_searchField"];
         }
         //修改placeHolder的颜色
         NSMutableAttributedString *placeholderString = [[NSMutableAttributedString alloc] initWithString:@"输入标题、简介" attributes:@{NSForegroundColorAttributeName : [UIColor lightGrayColor]}];
         textfield.attributedPlaceholder = placeholderString;

相关文章

网友评论

      本文标题:ios 修改UISearchBae placeholder的颜

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