How can I get the height of a specific row in my UITableView

前端 未结 4 1549
难免孤独
难免孤独 2021-02-04 00:29

In my UITableView i\'ve set different heights for different rows using the delegate method: tableView:heightForRowAtIndexPath:

Now given a

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 00:47

    You can use this

    CGRect frame = [tableView rectForRowAtIndexPath:indexPath];
    NSLog(@"row height : %f", frame.size.height);
    

    Using frame.size.height you can get height of particular row

    Swift 3

    let frame = tableView.rectForRow(at: indexPath)
    print(frame.size.height)
    

提交回复
热议问题