質問

I am trying make a segue call in a tableview , but the application crashes when I click on the cell ...

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

       switch (indexPath.row){
        case 0:
            [self performSegueWithIdentifier: @"segue1" sender: self];
            break;
        case 1:
            [self performSegueWithIdentifier: @"segue2" sender: self];
            break;
        case 2:
            [self button1];
            break;
        case 3:
            [self button2];
            break;  
}

case 2 and 3 work perfectly fine , but case 0 and 1 crash with the following green error :

thread 1:Program received signal "SIGBART".

thanks

役に立ちましたか?

解決

Make sure that the table/cell you are clicking on is associated with a view controller that has a storyboard.

The storyboard initiates the segue so when you say

[self ...]

It's saying tell MY storyboard to initiate the segue.

see Apple Documentation

Initiates the segue with the specified identifier from the view controller’s storyboard file.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top