0
我有一個表視圖,而不是從RSS源中填充項目。選擇一行時,標題,鏈接,描述和圖像將傳遞到詳細信息視圖。這可以工作,但是在選擇行和打開詳細視圖之間存在明顯的延遲。我試圖找到一種方法來優化這個延遲是不明顯的。開始前的延遲詳細信息從表視圖查看
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
GRSItemDetail *detail = [[GRSItemDetail alloc]initWithNibName:@"GRSItemDetail" bundle:nil];
RSSItem *entry = [[channel items]objectAtIndex:[indexPath row]];
NSURL *imageLink = [NSURL URLWithString:[entry bigImageURL]];
NSData *data = [NSData dataWithContentsOfURL:imageLink];
UIImage *image = [[UIImage alloc]initWithData:data];
detail.titleString = [entry title];
detail.descriptionString = [entry infoString];
detail.urlString = [entry link];
detail.itemImage = image;
[self.navigationController pushViewController:detail animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
是的,因爲你正在從didselect方法加載url中的數據。最好只將網址傳遞給GRSItemDetail,並將網址內容加載到GRSItemDetail的viewdidload中。 – Pawan