开发者

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];
}


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


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜