Pergunta

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!

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top