IBで作成したuitableviewがあります。そして、私は独自のuitableviewcellを設計しました(これはuiatbleviewcellのサブクラスであり、独自のxibファイルを持っています)。それを私のuitableviewに追加するにはどうすればよいですか?
私は試した
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath {
static NSString *CellIdentifier = @"myCell";
myCell *cell = (myCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *xib = [[NSBundle mainBundle] loadNibNamed:@"myCell" owner:self options:nil];
cell = [xib objectAtIndex:0];
}
// Configure the cell...
cell.title.text = @"tableCell";
cell.preview.text = @"preview";
cell.postedTime.text = @"right now";
return cell;
}
正しく動作しません。担当者が10人であるため、ここに画像を含めることはできません(画像をアップロードするには最低11が必要です)。だからここに私の悪い結果を示すためのリンクがあります。これは私が欲しいものです:http://img708.imageshack.us/img708/5082/20120903153930.png
これは私が持っているものです:http: //img836.imageshack.us/img836/5844/20120903154405.png