2012-05-02 4 views
3

나는 영원히이 이슈를 봤다. 탐색 막대가있는 테이블보기 컨트롤러와 하단에 도구 모음이 있습니다. 나는 그때 작동하지 그러나이UITableViewController가 도구 모음 항목을 표시하지 않습니까?

UIButton *button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 
button.titleLabel.text = @"Button"; 
UIBarButtonItem *buttonItem = [[[UIBarButtonItem alloc] initWithCustomView:button] autorelease]; 
[self setToolbarItems:[NSArray arrayWithObject:buttonItem] animated:NO]; 
[button release]; 

같은 도구 모음에 일부 항목을 추가

self.navigationController.toolbaHidden = NO; 

도구 모음을 보여줄 수 있어요. 나는 그것이 올바른 방법이라고 생각하지만 어쨌든 그것은 도구 모음에 아무 것도 보여주지 않습니다. 그 이유가 누구인지 압니까? 또는 도구 모음 항목을 추가하는 올바른 방법을 알고 있다면 알려주십시오. 고마워요.

건배,

답변

5
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:nil]; 
    UIBarButtonItem *buttonItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:nil]; 
    self.toolbarItems=[NSArray arrayWithObjects:buttonItem,buttonItem2,nil]; 
    self.navigationController.toolbarHidden = NO; 

바 버튼에 둥근 버튼을 추가하고 있기 때문에 표시되는 시스템 버튼이있는 툴바를 추가하려고합니다. ely work

+1

감사합니다. uibutton을 추가하는 것이 문제의 근원입니다! – Jeremy