У меня есть 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
вот код, который создает Информационный 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];
}
спасибо за любую помощь.
У вас пробовали мои ан? – Krunal
Почему вы инициализируете контроллер вида «init» вместо «initWithNibName: bundle:»? – viggio24
init должен быть в порядке, в худшем случае viewController не имеет вида и выглядит черным. Возможно, он называет 'initWithNibName: bundle:' из этого метода init. Я делаю это время от времени. –