我從文檔目錄中取回圖像,並希望在滾動視圖中顯示該圖像。圖像來自文檔目錄但不顯示在滾動視圖中。我有下面的代碼。我已經把滾動視圖graipically在廈門國際銀行,也科瑞出口..滾動查看不暈影圖像
self.scrollView.contentSize = CGSizeMake(320, 136);
self.scrollView.delegate = self;
int X=0;
for (int i = 0; i < [imageFileNames count]; i++)
{
NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%d/%d.png",b, i]];
UIImage *img = [UIImage imageWithContentsOfFile:getImagePath];
[images addObject:img];
NSLog(@"%@",getImagePath);
//imge.image=img;
UIImageView *imageView = [[UIImageView alloc] initWithFrame: CGRectMake(X, 0, 100, 100)] ;
[imageView setImage: [UIImage imageNamed:[NSString stringWithFormat:@"%d.png", i]]];
[self.scrollView addSubview: imageView];
X = X + imageView.frame.size.height+5;
if(X > 320)
self.scrollView.contentSize = CGSizeMake(X, 140);
}
檢查與背景顏色,是否有滾動視圖中添加或不圖像。 – Balu
我不明白你,先生 – Nasir
設置背景顏色到imageview,並檢查天氣圖像添加到滾動視圖或不,如果添加,然後問題是從文檔目錄中獲取圖像和顯示。 – Balu