0
탐색 모음에 검색 막대가 임베드되어 있습니다. 나는 배경색을 바꿀 수 있지만, 내 인생은 텍스트 색상을 바꿀 수 없다. 내 viewdidload에 다음 코드가 있습니다. 텍스트를 변경하려면 무엇이 누락 되었습니까?검색 창 텍스트 색을 변경할 수는 없지만 배경색을 변경할 수 있습니다.
나는 또한 시도했다[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor blueColor]];
:
if(!itemSearchBar)
{
itemSearchBar = [[UISearchBar alloc] init];
[itemSearchBar setFrame:CGRectMake(0, 0, self.view.frame.size.width, 55)];
itemSearchBar.placeholder = @"What are you looking for?";
itemSearchBar.delegate = self;
UITextField *txfSearchField = [itemSearchBar valueForKey:@"_searchField"];
txfSearchField.backgroundColor = [UIColor colorWithRed:130/255.0 green:58/255.0 blue:23/255.0 alpha:1.0];
UISearchDisplayController *searchCon = [[UISearchDisplayController alloc]
initWithSearchBar:itemSearchBar
contentsController:self ];
[searchCon setActive:NO animated:YES];
self.searchDisplayController = searchCon;
self.searchDisplayController.delegate = self;
self.searchDisplayController.searchResultsDataSource = self;
self.searchDisplayController.searchResultsDelegate = self;
self.searchDisplayController.displaysSearchBarInNavigationBar=YES;
나는 다음과 같은 작동하지만,하지 않는 것을 읽었습니다
itemSearchBar.tintColor = [UIColor redColor];
txfSearchField.textColor = [UIColor redColor];
어떤 제안 ???
감사합니다. 실제로 검색 도구에 색상 변경을 입력하라는 메시지가 나타납니다. 또한 여기에서 사용한 자리 표시 자 텍스트 색상 변경을 조사하라고 지시했습니다. http://stackoverflow.com/questions/1340224/iphone-uitextfield-change-placeholder-text-color – Ryasoh