저는 rootViewController가 있고 프로그래밍 방식으로 생성 된 UIButton을가집니다. 이 UIButton 다른보기 컨트롤러를 표시 할 싶습니다. 어떤 이유로 든 다음 오류로 인해 충돌합니다.메서드가 호출 될 때 프로그래밍 방식으로 생성 된 UIButton
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_TutorialViewController", referenced from: objc-class-ref in RootViewController.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status
여기에 Info UIButton을 생성하는 코드가 있습니다. 이 코드는에는 loadView 방법에 있습니다
// Create a Button to get Help
UIButton *helpButton = [UIButton buttonWithType:UIButtonTypeInfoDark ] ;
CGRect buttonRect = helpButton.frame;
// CALCulate the bottom right corner
buttonRect.origin.x = self.view.frame.size.width - buttonRect.size.width - 8;
buttonRect.origin.y = buttonRect.size.height - 8;
[helpButton setFrame:buttonRect];
[helpButton addTarget:self action:@selector(doHelp:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:helpButton];
}
가 여기에 또 다른 뷰 컨트롤러에 transisition 할 작업입니다 : 어떤 도움
- (IBAction)doHelp:(id)sender{
NSLog(@"help button pressed");
TutorialViewController *sampleView = [[[TutorialViewController alloc] init] autorelease];
[sampleView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:sampleView animated:YES];
}
감사합니다.
내 an을 사용해 보셨습니까? – Krunal
"initWithNibName : bundle :"대신 "init"으로 뷰 컨트롤러를 초기화하는 이유는 무엇입니까? – viggio24
init는 괜찮습니다. 최악의 경우 viewController에는 뷰가없고 검정색으로 표시됩니다. 어쩌면 그는이 init 메소드에서'initWithNibName : bundle :'을 호출 할 것입니다. 나는 때때로 이것을한다. –