我在滾動視圖中添加了一些圖像我得到的舞會圖像不顯示在滾動視圖上,所以請幫助,我的代碼如下。在水平滾動視圖中添加圖像不顯示圖像
-(void)addscroll
{
CGFloat btnX = 160.0;
int numberOfButton = 10;
for (UIView *subview in scrollView.subviews) {
[subview removeFromSuperview];
}
for (int i = 1 ; i <= numberOfButton; i++)
{
UIImageView *img=[[UIImageView alloc]init];
img.image=[UIImage imageNamed:@"1.png"];
//img.tag = i;
//[button setTitle:@"Excavations" forState:UIControlStateNormal];
img.frame = CGRectMake(160.0, 200.0, 160.0, 40.0);
[scrollView addSubview:img];
btnX = btnX + 165.0;
}
scrollView.contentSize = CGSizeMake(btnX + 50, 150);
}
你的scrollview的大小是多少? – NightFury
(160,198,320,150) – user1672134