作爲Xcode初學者,我想在我的應用程序的表格單元格中顯示縮略圖。現在,我有了解析JSON數據並將其發佈到單元格的標題和副標題中的代碼。如何在xCode中將縮略圖圖像顯示到表單元格?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainCell"];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MainCell"];
}
cell.textLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"receta"];
cell.detailTextLabel.text = [[news objectAtIndex:indexPath.row] objectForKey:@"koha"];
return cell;
}
如何顯示單元格右側的縮略圖?
謝謝。
創建一個自定義單元,您可以使用您自己的佈局。在Google上搜索自定義UITableViewCells。 – Popeye 2013-04-11 14:58:14
Popeye,你會介意幫助我嗎?我搜索了,但我沒有找到對我有用的東西,因爲我對Xcode有一些瞭解,這是我第三次今天打開它。 – 2013-04-11 15:00:27
我會推薦一些教程比。這裏是一個很好的教程http://blog.spritebandits.com/2012/03/13/creating-custom-uitableviewcells-from-xibs-step-by-step-tutorial/ – Popeye 2013-04-11 15:05:11