2013-05-28 49 views

回答

2
CGPoint pointInSuperview = [superview convertPoint:pointInSubview fromView:subView]; 

实施例:

UIView *subView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)]; 
[self.view addSubview:subView]; 

CGPoint pointInSubview = CGPointMake(20, 20); 
CGPoint pointInSuperview = [self.view convertPoint:pointInSubview fromView:subView]; 
NSLog(@"%@", NSStringFromCGPoint(pointInSuperview)); 

打印出{70, 70}到控制台

+0

非常感谢。 –