단추를 눌렀을 때 다음보기를로드 할 수 없습니다. 버튼을 만들고 IB의 버튼에 checkButtonPress 액션을 첨부했습니다. 그러나 시뮬레이터의 버튼을 누르면 다음 뷰 (ViewOne.xib)가로드되지 않습니다. 코드를 디버깅하려 할 때; NSLog (@ "View One")를 출력하고 있는데, 아래의 if 문에 코드가 그 지점에 도달했지만 다음보기가로드되지 않음을 의미합니다. ViewOne .h, .m .xib 파일을 이미 만들었습니다. 이 코드는 오류 또는 경고와 함께 잘 실행단추를 눌렀을 때보기를로드 할 수 없습니다.
#import "check1ViewController.h"
#import "ViewOne.h"
@implementation check1ViewController
-(IBAction) checkButtonPress: (id) sender{
int button = [sender tag];
if(button==1)
{
NSLog(@"View One");
ViewOne *tempObj = [[ViewOne alloc]initWithNibName:@"ViewOne" bundle:nil];
[self.navigationController pushViewController:tempObj animated:YES];
[tempObj release];
}
else if(button==2)
{
NSLog(@"View Two");
}
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
- (void)dealloc {
[super dealloc];
}
@end
: 다음은 check1ViewController.m 구현 파일로 작성된 코드입니다.
내가 작성하는 IB 또는 코드의 일부를 잃었거나 파일의 임의의 메소드를 오버라이드 (override) 할 필요합니까 ... 아니면 다른 방법
전에 IBAction를을 잃어 않은 경우 어떤 제안 미안하지만 나는 dev에 iPhone을 처음 접해서 내가 뭘 잘못했는지 확신하지 못했다. 사전에
덕분에
내비게이션 컨트롤러가 올바르게 설정 되었습니까? 해당 위치에 nil이 아닌지 확인하십시오. – Vladimir
프로젝트를 생성하는 동안 Window 기반 템플리트를 선택했는데 앞에서 설명한 - (IBAction) checkButtonPress 메소드가 다음 뷰를로드하는 유일한 코드입니다. 죄송합니다 ... 궁금한 점은 무엇이든 놓치 셨습니다. – Prazi