2011-09-20 2 views
0

도움이 필요합니다. 내 아이폰 앱에서는 다음과 같이했습니다. http://i56.tinypic.com/10zn43p.png .보기 컨트롤러를 navigationController로 푸는 데 문제가 있습니다.

거리를 선택하면,이 같은 다른보기를 표시해야합니다 헤더 파일

@interface RecherchePartenaireViewController : UIViewController <UINavigationControllerDelegate> 
{ 
    UINavigationController *navigationController; 
    UITableView *tableViewRecherchePartenaire; 
    RecherchePartenaireTypePartenaireViewController *recherchePartenaireTypePartenaireViewController; 
    RecherchePartenaireDistanceViewController *recherchePartenaireDistanceViewController; 
} 
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController; 
@property (nonatomic, retain) IBOutlet UITableView *tableViewRecherchePartenaire; 
@property (nonatomic, retain) IBOutlet RecherchePartenaireTypePartenaireViewController *recherchePartenaireTypePartenaireViewController; 
@property (nonatomic, retain) IBOutlet RecherchePartenaireDistanceViewController *recherchePartenaireDistanceViewController; 

@end 

에서의

: 나는 그것을 어떻게 http://i51.tinypic.com/vzga6h.png 다음

인을 구현 파일

테이블의 세 번째 행을 선택 0

나는이 작업을 수행 :

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
     if (indexPath.row==3){ 
      NSLog(@"RecherchePartenaireDistanceViewController..."); 
      recherchePartenaireDistanceViewController = [[RecherchePartenaireDistanceViewController alloc] init]; 
      recherchePartenaireDistanceViewController.recherchePartenaireViewController=self; 

      [self.navigationController pushViewController:recherchePartenaireDistanceViewController animated:YES]; 

     } 

    } 

는이 work.Thank 당신에게 보이지 않는 원인이 내가 잘못 갈거야을 가르쳐주세요.

+0

내가 내비게이션 컨트롤러를 참조하지 말아 부모 개체 ... – Nekto

+0

내가 이것을 넣으면 : [self.view addSubview : navigationController.view]; viewDidLoad에서 tableview는 선택 취소됩니다 ... 그리고 tableview에서 변경할 텍스트 필드가 있습니다.이 줄로 키보드가 나타나지 않습니다 ... 어떻게해야합니까? – Gabrielle

+0

다음과 같은 방법으로 푸시 (push) 할 수 있습니다 :'[self presentModalViewController : recherchePartenaireDistanceViewController animated : YES]; ' – Nekto

답변

0

첫 번째 tableView가있는 rootContController와 함께 navigationController 객체를 사용하는 것이 접근법입니다. didSelectRowAtIndexPath : 메소드에서 지금 당장 실행하십시오. 그러면 detailViewController가 푸시됩니다. 그리고 rootViewController에서 탐색 바를 숨 깁니다.

0

의견을 여기에서 옮깁니다.

루트보기에 탐색 컨트롤러를 추가해야합니다. 그렇지 않으면 메서드 pushViewConroller:을 호출 할 수 없습니다.

예를 들어, 같은 방식으로 루트 뷰 컨트롤러를 만들 수 있습니다

RootViewController *controller = [[RootViewController alloc] init]; 
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller]; 
[controller release]; 
당신은 같은 방법으로, 예를 들어, 탐색 컨트롤러를 밀어 수 있습니다

:

[self presentModalViewController:navController animated:YES]; 
관련 문제