Sheehan Alam
Sheehan Alam

Reputation: 60869

How can I make the contents inside my UIView scrollable?

I have a UIView that contains my UIScrollView (with a bunch of elements inside) in IB. The scrollView is wired up properly, but the content inside does not scroll. Not sure why?

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

 scrollView.contentSize = CGSizeMake(320,600);
 scrollView.showsHorizontalScrollIndicator = NO;
 scrollView.showsVerticalScrollIndicator = NO;
 scrollView.scrollsToTop = NO;


 self.title = titleDescription;

 self.descriptionTextView.text = bodyDescription;
 self.addressTextView.text = address;
 self.phoneTextView.text = phone;
 self.websiteTextView.text = website;
    [super viewDidLoad];
}

Upvotes: 2

Views: 2433

Answers (2)

Ole Begemann
Ole Begemann

Reputation: 135548

You need to set the scroll view's contentSize property in code (it can't be done in Interface Builder).

Upvotes: 3

Sergio Moura
Sergio Moura

Reputation: 4942

Don't put an UIView inside the UIScrollView.

Make the scroll view as tall as you like, and the iPhone will take care of your "scrolling needs".

You can, however, put multiple UIViews inside the UIScrollView and you'll be able to scroll the views to get where you want to, but I don't think that's what you're aiming for...

Upvotes: 0

Related Questions