ios 修改UISearchBae placeholder的颜

2023-03-13  本文已影响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;
上一篇 下一篇

猜你喜欢

热点阅读