UITableViewCell indexPath crash in iOS7

后端 未结 6 2043
不知归路
不知归路 2020-12-06 07:38

I\'ve a UITableViewCell in a UITableViewController. In my cell there is a button that when you click takes you to another view with a

6条回答
  •  半阙折子戏
    2020-12-06 08:11

    In iOS7 UITableViewWrapperView is the superview of UITableViewCell, which means another superview for you:

    iOS7:

    UITableView *tableView = (UITableView *)cell.superview.superview;
    

    iOS6"

    UITableView *tableView = (UITableView *)cell.superview;
    

    Another change you can find it here:

    seems your code: UITableView table = (UITableView)[[[sender superview] superview] superview]; returns a UITableViewCell not a UITableView.

    Try the below:

    UITableView *table = (UITableView*)[[[[[sender superview] superview] superview] superview] superview];
    

提交回复
热议问题