[英]iphone : get coordinates from subviews with respect to self.view
在這里,A,B ... Z是帶有表的自定義單元格,
如何獲取有關CGRect
按鈕的self.view
? 我嘗試使用CGRectIntersection
和CGRectUnion
方法,但無法正常工作! 對於如我需要CGRect
,讓我在這個按鈕的位置self.view
您需要兩步計算
對於步驟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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.