views:

298

answers:

1

I've done this to get the view:

[self.superview viewWithTag:10]

But how can I get that view's viewcontroller. Just like you can get the the viewcontroller's view I want to go the other way so I can send a message (call a method) to that viewcontroller. eg:

[[self.superview viewWithTag:10].viewController doSomething];

(obviously that not actual code but I want something like that)

A: 

Views shouldn't need to do that.

tc.
why not, could you explain more?
Jonathan
Views should send actions to their parent view controllers. The view controllers might need to talk to each other, but views themselves should be self-contained. If you need access to the view controller, you can add a property to your custom view class, but it's not really good design.
tc.