I am new to iphone development.I want to to access the instance variable declared in uiview from its uiview subview.pl开发者_运维百科ease help me out .Thanks.
Technically, you can just do [[self superview] foo]
from within one of the child's instance methods and that will give you access to the foo
property on the parent (you may have to cast the superview, though). But something to consider is that in hierarchical data structures (like the UIView hierarchy), it's generally good practice for children to not "know" too many of the details of their parents, where possible.
UIView has a superview
property that will point to the view's superview if it has one.
You can send messages to the object it points to.
view.superview.iVar
精彩评论