문제

So i have a programatically added button in my View Controller. Because of this I have created a push segue directly from my root View Controller to the next one. Already embedded the navigation controller.

This is me setting up the button and adding it's target;

registerButton = [UIButton buttonWithType:UIButtonTypeCustom];

[registerButton addTarget:self action:@selector(pushRegisterScreen) forControlEvents:UIControlEventTouchUpInside];

This right here is the pushRegisterScreen;

- (void) pushRegisterScreen
{
    [self performSegueWithIdentifier:@"registerSegue" sender:self];
}

But this throws this exception;

'NSInvalidArgumentException', reason: '-[RegisterScreen _setViewDelegate:]: unrecognized selector sent to instance 0x8d70d70'

First day with Xcode yay!

도움이 되었습니까?

해결책

I've seen this error before when you've set the class of a view (probably your controller's main view) to a class that's not a subclass of UIView. Make sure that when you set the custom class of your controller (in the storyboard) that you've set it on the controller, not its view.

다른 팁

Did you actually set the identifier @"registerSegue" in your storyboard? To do this go to the view controller in question and click it, then go to the identity inspector (right panel) and give the view a name. If you have already done this then the problem is within another location.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top