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. ScrollView is connected correctly, but the content inside does not scroll. Do not know 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];
}
+3
source share
2 answers

You need to set the scroll property contentSizein the code (this cannot be done in Interface Builder).

+3
source

Do not place a UIView inside a UIScrollView.

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

, , UIView UIScrollView, , , , , ...

0

Source: https://habr.com/ru/post/1780917/


All Articles