将rect由rect所在视图转换到目标视图view中,返回在目标视图view中的rect
这里用来获取self在window上的位置
- (CGRect)convertRect:(CGRect)rect toView:(nullable UIView *)view;
例如:在cell中调用
CGRect toWindow = [self convertRect:self.bounds toView:self.window];
toWindow为相对于屏幕的位置
将rect由rect所在视图转换到目标视图view中,返回在目标视图view中的rect
这里用来获取self在window上的位置
- (CGRect)convertRect:(CGRect)rect toView:(nullable UIView *)view;
例如:在cell中调用
CGRect toWindow = [self convertRect:self.bounds toView:self.window];
toWindow为相对于屏幕的位置