I’ve got quite a problem with UIScrollView – I have a SwitchViewController (which is the root controller) with a method
-(BaseView*)loadView:(EActiveWindow)nextView`
Now, I found some quite useful info on the internet, but something is missing or I’m not loading views correctly. In the loadView method I have created a few view controllers if you choose an option from menu and I switch view finally with something like this:
activeView.controller = self;
[self.view insertSubview:activeView.view atIndex:0];
currentController = activeView;
return activeView;
Every view controller chosen initialized in root view controller is a BaseView object, where BaseView : UIViewController.
I checked one solution from http://www.youtube.com/watch?v=UMv154TWTr8 and it worked, but I guess that problem is in my root controller where I kill and create views, which causes non scrolling screen – any thoughts, anybody?
EDIT:
If it somehow relevant – content of this scroll view will be changed depending on user’s choices (text & images).
turns out it’s not about switching views in root controller
after reading this tutorial I managed to implement correctly UIScrollView 🙂
and this helped me with clearing UIScrollView content before loading new data 🙂
to bo stack-correct 😉 I include explicite my solution:
1) I added
IBOutlet UIScrollView *scrollViewto my UIView class2) I added to my class implementation this, to initialize my scrollView with proper size
3) then I added to viewWillAppear method block of code creating few UITextView and putting them into scrollView, finally resize scrollView and voila 🙂