2013-10-07 1 views
47

앱의 UISearchBars의 경우, iOS 7에서 실행될 때 포커스가있는 막대에 커서가 표시되지 않습니다. 어떻게 표시합니까?커서가 우리 앱의 UISearchBar에 표시되지 않습니다.

우리는 최소 목표 6을 사용하여 SDK 7을 사용하고 있습니다. 탐색 막대에 대해 반투명을 해제하고 런타임에 색상을 설정합니다. 나는 우리가 다르게 행동하고있는 것을 생각할 수 없다.

답변

100

우리의 문제는 색조의 색이 흰색으로 설정되어있어서 보지 못했다는 것입니다.

+0

동일한 문제가 내 편이었습니다. 덕분에 –

+1

커서가 버튼과 다른 색상이되게하려면 : http://stackoverflow.com/a/42444940/4754881 –

+0

같은 문제 .. 감사합니다 –

26

설정

searchBar.tintColor = [UIColor blueColor]; 
+1

검색 막대의 색상은 (66, 107, 242) 인 것 같습니다 – cncool

0

그냥 스토리 보드, XIB 또는 코드에서 UISearchBar에 대한하려면 tintColor을 설정합니다. Xcode는 기본 tintColor를 무시하는 것으로 보입니다.

5

검색 상자 속성 창

열기보기 섹션> 색조 설정 - 기본값. 이 도움이 될 것입니다

enter image description here

희망.

0

searchBars 하위 뷰를 반복하고 uitextfield 하위 뷰를 가져 와서 @ "insertionPointColor"값을 원하는 색으로 설정할 수 있습니다. 작동하지만 개인 API를이다

for (UIView *subView in self.searchBar.subviews) { 
    if ([subView isKindOfClass:[UITextField class]]) { 
     [[(UITextField *) subView valueForKey:@"textInputTraits"] setValue:[UIColor blackColor] forKey:@"insertionPointColor"]; 
    } 
} 
2

이 그것이 스위프트에서 수행 할 수있는 방법입니다 : .blue 또는 어떤 것보다

override func viewWillAppear(animated: Bool) { 
    self.searchBar.tintColor = UIColor.whiteColor() 

    let view: UIView = self.searchBar.subviews[0] as! UIView 
    let subViewsArray = view.subviews 

    for (subView: UIView) in subViewsArray as! [UIView] { 
     println(subView) 
     if subView.isKindOfClass(UITextField){ 
      subView.tintColor = UIColor.blueColor() 
     } 
    } 

} 
+0

내 Xamarin C# 포트는 다음과 같습니다. UIView view = searchBar.Subviews [0]; foreach (view.Subviews의 UIView 항목) { if (항목이 UITextField 인 경우) { item.TintColor = UIColor.Blue; } } –

0
searchBar.tintColor = view.tintColor // self.view usually has the proper tintColor 

더 나은.