代码如下:
self.scroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 65, 320, 100)];
[self.view addSubview:_scroll];
_scroll.backgroundColor = [UIColor greenColor];
_scroll.contentSize = CGSizeMake(self.view.frame.size.width*4, 0);
for(int i = 0;i < 5 ; i ++)
{
UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",i+1]]];
image.frame = CGRectMake(320*i,0,320,100);
[_scroll addSubview:image];
}
为什么在scroll(他是UIScrollView类型的)视图上的 UIImageView视图不是和scroll一样大,imageview视图加入到scroll视图后,坐标不是以scroll为基准的吗?
如图:绿色区域为scroll,我认为当image坐标为(0,0,320,100)的时候应该充满scroll的可是结果却如下,求大神指导指导这是为什么呢?急!!!!!