First method after touching a table view cell didSelectRowAtIndexPath or prepareforSegue?

后端 未结 1 763
暖寄归人
暖寄归人 2021-01-26 15:58

I have designed a table view of various books in sections according to their type.If user touches on cell ,a segue is performed to a new view controller which needs a book item.

1条回答
  •  盖世英雄少女心
    2021-01-26 16:14

    I think you have to link segue not with cell but with view of the current view controller. In such case when you click on cell

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    

    will not be called. Then in

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

    you can manualy perform segue:

    [self performSegueWithIdentifier:@"MySequeIdentifier" sender:self];
    

    0 讨论(0)
提交回复
热议问题