LoginSignup
12
12

More than 5 years have passed since last update.

任意のタイミングで、UITableViewCellのCGRectを取得する

Last updated at Posted at 2014-07-08

任意のタイミングで位置を取得し、Actionさせたい場面があったので、調べたことをメモ。

NSIndexPath *indexpath = [NSIndexPath indexPathForRow:0 inSection:0];

CGRect rectOfCellInTableView = [tableview rectForRowAtIndexPath:indexpath];
CGRect rectOfCellInSuperview = [tableview convertRect:rectOfCellInTableView toView:[tableview superview]];

CGPoint pointer = CGPointMake(rectOfCellInSuperview.size.width, rectOfCellInSuperview.size.height);

上記で、正しい座標を取得出来ます。

参考サイト stackoverflow

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12