他們有很多教程,你可以下載源代碼,並可以閱讀的UITableView蘋果,在這裏你可以看到教程Here 。 下面是基本默認情況下顯示圖像,標題和副標題代碼
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *CellIdentifier [email protected]"Cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.imageView.image=[UIImage imageNamed:[imageArray objectAtIndex:indexPath.row]];
cell.textLabel.text=[titleArray objectAtIndex:indexPath.row];
cell.detailTextLabel.text=[subtitle objectAtIndexPath.row];
return cell;
}
如果妳想要一個自定義單元格,然後,根據您的需要設置框,並使用SDWebImage庫緩存圖像
UserImageView =[[UIImageView alloc]initWithFrame:CGRectMake(5,0,70, 70) ];
nameLbl=[[UILabel alloc]initWithFrame:CGRectMake(95, 20, 200, 20)];
[nameLbl setText:nameStr];
[UserImageView setImageWithURL:[NSURL URLWithString:responseString] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
[cell.contentView addSubview:nameLbl];
[cell.contentView addSubview:UserImageView];
你可以添加新的飼料到當前的數組和重新加載表,併爲新的飼料,你可以使用拉來刷新像功能 –
你GOOGLE嗎? http://www.google.co.uk/search?q=custom+uitableviewcell+tutorial – Wain
感謝您的評論,我想知道什麼是實施它的最佳方式,如果有開源框架爲了那個原因。 –