【发布时间】:2013-01-31 12:31:57
【问题描述】:
这里,A, B ... Z 是带有表格的自定义单元格,
我怎样才能获得与self.view 的按钮相关的CGRect?我尝试了CGRectIntersection 和CGRectUnion 方法,但它不起作用!
例如我需要CGRect 给我该按钮在self.view 中的位置
【问题讨论】:
标签: iphone coordinates cgrect
这里,A, B ... Z 是带有表格的自定义单元格,
我怎样才能获得与self.view 的按钮相关的CGRect?我尝试了CGRectIntersection 和CGRectUnion 方法,但它不起作用!
例如我需要CGRect 给我该按钮在self.view 中的位置
【问题讨论】:
标签: iphone coordinates cgrect
你需要两步计算
对于第 1 步,您可以使用
[UITableView rectForRowAtIndexPath]
例如CGRect rect_cell = [table_view rectForRowAtIndexPath:index_path_target_cell];
那么对于第 2 步,(如果您还不知道按钮与单元格原点的偏移量)
CGRect rect_button = _button.frame;
CGPoint point_answer = CGPointMake(rect_cell.origin.x + rect_button.origin.x , rect_cell.origin.y + rect_button.origin.y);
【讨论】:
self.view 中获得该职位?