對iphone開發非常新穎,我似乎無法弄清楚爲什麼會發生這種情況。我敢肯定,它有一些事情與事實,即boardView是n它創建一個新的事實。但即時通訊圖像應用到新形成的imageView,所以我不知道發生了什麼事情。像我說的,一切正常。我收到我的物品列表,點擊一個物品,然後轉到下一頁,並顯示正確的圖像(除第一次以外)。下一個視圖第一次顯示錯誤的圖像
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger row = [indexPath row];
if(self.boardView == nil){
BoardView *aboardView = [[BoardView alloc]initWithNibName:@"BoardView" bundle:nil];
self.boardView = aboardView;
[aboardView release];
}
NSString *filePath = [[NSBundle mainBundle] pathForResource:[snowBoardArray objectAtIndex:row] ofType:@"png"];
UIImage *theImage = [[UIImage alloc] initWithContentsOfFile:filePath];
self.boardView.imageView.image = theImage;
[theImage release];
[self.navigationController pushViewController:self.boardView animated:YES];
}
boardView幾乎是一片空白的UIViewController與具有添加的ImageView
非常感謝你的工作。我在if語句之後添加了這行,看看它是否爲零。 – 2011-05-26 14:26:28
只是所以我明白imageView被創建,但uiViewController不是?那就是這個聲明啓動 – 2011-05-26 14:31:17
它創建了一個視圖,它會創建其中的其他小部件。 – 2011-05-26 14:36:33