I am new to iphone development.I want to to access the instance variable declared in uiview from its uiview subview.please help me out .Thanks.
+1
A:
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.
Jasarien
2010-02-06 21:09:24
Although, if this superview a subclass of `UIView`, you will have to cast it or thecompiler will throw warning at you. `[(MYViewClass*)[self superview] doStuff]`
Squeegy
2010-02-06 21:13:26
+1
A:
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.
erikprice
2010-02-06 21:16:21