2010-07-14 3 views
1

내 응용 프로그램에서는 modalViewController 위에 탐색 막대가 표시되지만 navigatiobar에 barbutton을 추가 할 수는 없습니다. 나는 다음과 같은 코드를 사용하고 있습니다 :modalView를 사용하여 탐색 바에 barButton 추가 iphone

편집 : 사전에

displayController = [[UIViewController alloc]initWithNibName:nil bundle:nil]; 

UINavigationController *cntrol = [[UINavigationController alloc] initWithRootViewController:displayController]; 

[displayController setTitle:@"TEST"]; 


UIBarButtonItem *submit = [[UIBarButtonItem alloc] 
          initWithBarButtonSystemItem:UIBarButtonSystemItemDone 
          target:self 
          action:@selector(displayViewForPosts)]; 

displayController.navigationItem.rightBarButtonItem = submit; 
[submit release]; 

UIBarButtonItem *newsfeed = [[UIBarButtonItem alloc] 
          initWithBarButtonSystemItem:UIBarButtonSystemItemDone 
          target:self 
          action:@selector(displayViewForPosts)]; 
displayController.navigationItem.leftBarButtonItem = newsfeed; 
[newsfeed release]; 

[self presentModalViewController:cntrol animated:YES]; 
[cntrol release]; 
[displayController release]; 

고맙습니다.

답변

1
UIViewController *detailViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil]; 

UINavigationController *cntrol = [[UINavigationController alloc] initWithRootViewController:detailViewController]; 

[detailViewController setTitle:@"TEST"]; 


UIBarButtonItem *submit = [[UIBarButtonItem alloc] 
          initWithBarButtonSystemItem:UIBarButtonSystemItemDone 
          target:self 
          action:@selector(displayViewForPosts)]; 
detailViewController.navigationItem.rightBarButtonItem = submit; 
[submit release]; 


[self.navigationController presentModalViewController:cntrol animated:YES]; 
[cntrol release]; 
+0

답장을 보내 주 시겠지만 아직 작동하지 않습니다. 업데이트 된 코드로 내 질문을 수정했습니다. 어디에서 잘못 될지 알려주실 수 있습니까? – neha

+0

무슨 문제가 있습니까? 모달 뷰가 여전히 표시되지 않습니까? –

+0

아니오, modalview도 이전에 나타났습니다 .. 어떻게 갑자기 버튼이 나타 났는지 모르겠군요 ... 고맙습니다. – neha