1

i added some views (every view has its own viewcontroller and nib) to an UIScrollView. How can I access the ScrollView from within the UIViews I've added?

self.view.superview doesn't get me the UIScrollView properties. I need to disable scrollEnabled from within an UIView.

Thank you!

trnc
  • 20,581
  • 21
  • 60
  • 98

1 Answers1

2

Maybe try (UIScrollView*)(self.view.superview).property to access the property you want :-) It should work.

But maybe with an Delegate it would be better :-p

Good Luck !

Vinzius
  • 2,890
  • 2
  • 26
  • 27
  • http://en.wikipedia.org/wiki/Delegation_pattern Delegates are a fundamental concept of Objective-C programming, you should definitely look them up. – Philipp Schlösser Sep 21 '10 at 17:38
  • when using (UIScrollView*)(self.view.superview).property I only get the same UIView properties like before! – trnc Sep 21 '10 at 17:47
  • 1
    I think you should try a Delegate ;-) it's the best way in your case. Search for iphone delegate on google and you should find some tutorials. – Vinzius Sep 21 '10 at 18:49