adi*_*dit 3 iphone objective-c uiview ipad ios
我有一堆水平UITableView放在UIViewController1中.我想找到被点击的UITableViewCell的位置,我想根据UIViewController1得到位置.所以这就是我在didSelectRowAtIndexPath中所做的:
MyCell *cell = (MyCell *)[tableView cellForRowAtIndexPath:indexPath];
UIView *animatedView = [[UIView alloc] initWithFrame:cell.frame];
[animatedView setFrame:[animatedView convertRect:animatedView.frame toView:self.newsRackController.view]];
Run Code Online (Sandbox Code Playgroud)
但是,似乎这不能正确转换它.我究竟做错了什么?
您需要从UITableView的视图转换UITableViewCell的CGRect,然后再将其转换为视图控制器视图.
但不是全部,也许你可以使用UITableView的方法
- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
获取此CGRect并将其转换为您的UIViewController的视图.