Reputation:
I am adding subview to master view. But I want to draw that subview based on UIWindow Middle coordinate, not based on superview(masterview)? Is it possible in iPhone SDK?
Upvotes: 1
Views: 217
Reputation: 8734
A view's frame.origin
is always relative to its superview's bounds and insets. You just need to do the proper conversion. What you probably need is something like:
myView.frame = [myWindow convertRect:myView.frame fromView:[myView superview]];
I'm not positive that this is exactly what you need, but there are several convertRect:…
methods on UIView
. Study their docs and you should know the right thing for your use case. For more help, see this post.
Note that this only works after all the views are added as subviews in a consistent structure. It won't work before they are assembled.
Upvotes: 1