2009-09-03 6 views
1

여기에 iPhone 프로그래밍 초보자 용 질문이 있습니다. 기본보기에서 버튼을 눌러 다른보기로 이동하려면 어떻게합니까?iPhone이 버튼을 눌렀을 때 다음보기로 전환하는 방법?

나는 내가 버튼을 누르고, 디버깅 할 때 실행되는 다음 함수는, 그가 거기 통과,하지만 내 "경고"보기가 표시되지 않습니다 있습니다

-(IBAction) showWarningView:(id)sender 

{ 

    if(self.showWarning == nil){ 
     WarningViewController *nextView = [[WarningViewController alloc] initWithNibName:@"Warning" bundle:[NSBundle mainBundle]]; 
     self.showWarning = nextView; 
     [nextView release]; 
    } 
    [self.navigationController pushViewController:self.showWarning animated:YES]; 

} 

내 주요 RootViewController은 다음과 같습니다 : 나는있는 UITableViewController의 탐색 컨트롤을 사용하고하지만 내가보기 기반 응용 프로그램에서 버튼을 누를 때 단지 내 다른보기를 표시하는 데 사용해야합니까

#import <UIKit/UIKit.h> 
#import "WarningViewController.h" 

@interface RootViewController : UIViewController { 
    IBOutlet UIButton *button1; 
    WarningViewController *showWarning; 

} 
@property(nonatomic,retain) WarningViewController *showWarning; 

-(IBAction) showWarningView:(id)sender; 

@end 

? 감사합니다.

답변

0

당신은 아마에서보기를 밀어해야

당신이있는 UITableViewController의 탐색 컨트롤을 사용하는 경우를 편집하면 tableviewcontrollers 네비게이션 컨트롤러이 당신이 당신의 ViewController에에 tableviewcontroller의 네비게이션 컨트롤러를 통과 의미 , 그럼 당신은 단지 그것을 밀어

예 :

[self.tableViewControllersNavigationController pushViewController:self.showWarning animated:YES]; 

+0

그래, 우리가 어쨌든 위의 글을 쓴 것은 아니겠습니까? 그가 실제로 그걸 사용하고 싶지 않은 것 같아요. – cssmaniac

+0

@dimitri ye, 더주의 깊게 읽고, 지금 편집 했어야했습니다. – gabtub

0

당신의 탐색 모음 변화에 제목을 하는가 (에 tableViewController의있는 navigationController을 전달하는, 당신은 위임 패턴을 만들어야 할 수도 있습니다)? 인터페이스 빌더 파일 내부에 UIViewController와 연관된 UIView가 없을 수도 있습니다.

관련 문제