以下是我的代碼。我可以從我的NSMutableArray文件加載所有圖像文件,但它沒有出現在我的屏幕上。我真的不知道爲什麼。如果任何人都可以幫助我,這將是非常好的。UIImage沒有顯示在我的屏幕上
在此先感謝.....
UIImageView *bannerImages;
CGRect bannerFrame;
for (int photoCount = 0; photoCount < [imagesFileList count]; photoCount++)
{
NSLog(@"photoCount: %d",photoCount);
bannerImages = [[UIImageView alloc] initWithFrame:CGRectMake(0, 340, 320, 80)];
NSString *photoString = [NSString stringWithFormat:@"%@",[imagesFileList objectAtIndex:photoCount]];
NSLog(@"photoString are: %@",photoString);
bannerImages.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:photoString]];
bannerFrame = bannerImages.frame;
bannerFrame.origin.y = self.view.bounds.size.height;
}
[UIView animateWithDuration:1.0
delay:1.0
options: UIViewAnimationTransitionCurlDown
animations:^{
bannerImages.frame = bannerFrame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
[self.view addSubview:bannerImages];
[bannerImages release];
這裏是我的日誌文件顯示:
2013-05-30 15:09:19.595 Yangon Guide Map[5035:15803] photoCount: 0
2013-05-30 15:09:19.596 Yangon Guide Map[5035:15803] photoString are: adv01.png
2013-05-30 15:09:19.596 Yangon Guide Map[5035:15803] photoCount: 1
2013-05-30 15:09:19.596 Yangon Guide Map[5035:15803] photoString are: adv02.png
2013-05-30 15:09:19.596 Yangon Guide Map[5035:15803] photoCount: 2
2013-05-30 15:09:19.596 Yangon Guide Map[5035:15803] photoString are: adv03.png
2013-05-30 15:09:19.597 Yangon Guide Map[5035:15803] photoCount: 3
2013-05-30 15:09:19.597 Yangon Guide Map[5035:15803] photoString are: edupro.png
2013-05-30 15:09:21.598 Yangon Guide Map[5035:15803] Done!
檢查是否有任何其他子視圖阻止您的圖像視圖在層次結構中。 – Meera
它不阻擋meera,如果我只加載一個具有確切名稱的圖像例如。 @「edupro.png」顯示我想顯示的位置。所以它不是等級問題,但感謝您的答案。 :) – Tin
現在工作嗎?@Tin – Meera