此代码显示滚动视图,但我想要显示的图像(教程)大于视图。换句话说,tutorial.png 正好是 280X1200,但它不会有 aspectFit。我在这里遗漏了一些小东西:
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];