2012-08-16 1 views
1

프로그래밍 방식으로 만든 UISearchBar에서 작업하고 있습니다. 아래는 내가 가진 문제가 발생하고있는 무슨이다 : 나는이 검색 창에 해당 행을 제거 할 수 있습니까UISearchBar 이상한 막대 줄

http://oi46.tinypic.com/2lo25qu.jpg

?

코드는 다음과 같습니다 : 당신은 clearColor으로 배경 색상을 설정하는

[self setBackgroundColor:[UIColor clearColor]]; 
[self setBarStyle:UIBarStyleDefault]; 
[self setTintColor:[UIColor whiteColor]]; 
[self setShowsCancelButton:NO]; 
+1

우리에게 당신을하는 데 도움이되는 몇 가지 관련 코드를 제시해주십시오 : – limon

+0

이 질문을 받고 여기에서 해결되었습니다 : [Customize UISearchBar] (http://stackoverflow.com/questions/7620564/customize-uisearchbar-trying-to-get-rid-of-1px-black-line-underneath-the- 검색? rq = 1) – SethHB

답변

0

. 대신 UISearchBar의 배경 뷰를 제거 할 수 있습니다

for(UIView *view in [searchBar subviews]){ 
    if([view isKindOfClass:NSClassFromString(@"UISearchBarBackground")]){ 
     [view removeFromSuperview]; 
    } 
} 

// in the above code in place of "searchBar" you have to use "self" 
+0

감사합니다. 매력처럼 작동했습니다. – kforkarim

0

당신은 라인을 제거하는 5 + iOS에서

[[UISearchBar appearance] setSearchFieldBackgroundImage:[UIImage imageNamed:@"someImage.png"]forState:UIControlStateNormal]; 

를 사용할 수 있습니다.

self.searchBar.layer.borderWidth = 1; 
self.searchBar.layer.borderColor = [[UIColor redColor] CGColor]; 
0

은 내가 한 일은 지지층을 변경했다.