0

what is the difference between this two instruction

scrollView.frame=CGRectMake(0, -100, 960, 100);

[scrollView setContentSize:CGSizeMake(960, 100)];

1 Answers1

0

scrollView.frame=CGRectMake(0, -100, 960, 100);

Sets the frame of the UIScrollView. Which means you set the origin and the visible size of UiScrollView on your view.

[scrollView setContentSize:CGSizeMake(960, 100)];

Sets the Content size of your UIScrollView. You use a UIScrollView, because you have more content to display than you can show within the frame of your view. Therefore you have to set the size of the contentView, which you scroll up and down.

Take a look at the Apple docs:Creating and Configuring Scroll Views

Max B.
  • 881
  • 10
  • 21