Created
August 6, 2014 17:58
-
-
Save cybersamx/d94f854b8f714ba56b00 to your computer and use it in GitHub Desktop.
To find the coordinate of subview in the view controller view coordinate system.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create nested subviews. self.view > subview1 > subview2 | |
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 20, 300, 300); | |
[self.view addSubview:subview1]; | |
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30, 200, 200); | |
[superview addSubview:subview2]; | |
// To find the coordinate of subview in the view controller view coordinate system. | |
CGPoint point = [subview1 convertPoint:subview2.frame.origin toView:self.view]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment