UITableViewCell 在IOS7的父视图是UITableViewWrapperView

来源:互联网 发布:手机设计软件 编辑:程序博客网 时间:2024/06/05 01:08

UITableView *tableView;

     float Version=[[[UIDevice currentDevice] systemVersion] floatValue];

    if(Version>=7.0&&Version<8.0)

    {

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

    }

    else

    {

        tableView=(UITableView *)self.superview;

    }

     NSIndexPath *indexPath= [tableView indexPathForCell:self];

    indexPath = [NSIndexPath indexPathForRow:kImage1IndexinSection:indexPath.row];


在IOS7以下系统,UITableViewCell.superview就是UITableView,但在IOS7中,cell上面还多了一个UITableViewWrapperView,所以需要UITableViewCell.superview.superview获取UITableView

0 0