2011-07-06 10 views
-1

// self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem : // UIBarButtonSystemItemAdd target : 자습서 : @selector (addWord)] autorelease];내비게이션 막대를 추가하는 방법 UISearchBar

여기에 naide bar에 rightide 버튼을 추가 할 수 있습니다.

내비게이션 막대 중간에 UISearchBar를 추가하는 방법.

답변

0

내비게이션 바에 UISearchBar을 왜 원하는지 잘 모르겠습니다. 일반적으로 구현이 탐색 모음 바로 아래에 있으며 사용자가 직접 설정할 수 있습니다. tableHeaderView

그러나 검색 바를 탐색 모음에 추가하는 경우 UISearchBar을 직접 추가 할 수 없습니다. 탐색 바 및 UISearchBar를 하위보기로보기에 추가 한 다음 (comboView) 다음을 self.view 또는 tableHeaderView에 추가 할 수 있습니다.

UIView * comboView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 45)]; 
[comboView addSubview:navigationBar]; 
[comboView addSubview:searchBar]; 

// You should have allocated the navigation bar and the search bar before this though. 

self.tableView.tableHeaderView= comboView; 
관련 문제