下面代码显示了scrollView
,但是需要显示的图片(tutorial)比view大。
tutorial.png的尺寸是280X1200
。
tipScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(20, 10, 280, 1200)];
tipScroll.showsVerticalScrollIndicator = YES;
tipScroll.scrollEnabled = YES;
tipScroll.userInteractionEnabled = YES;
UIImageView *tutorialImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"tutorial"]];
tipScroll.contentMode = UIViewContentModeScaleAspectFit;
tutorialImageView.contentMode = UIViewContentModeScaleAspectFit;
tipScroll.contentSize = tutorialImageView.frame.size;
[self.view addSubview:tipScroll];
[tipScroll addSubview:tutorialImageView];