以下のスナップショットに示すように画像とテキストを追加するにはどうすればよいですか?アプリケーションですでにナビゲーションコントローラーを使用しているので、ホームページからの新しいナビゲートページとしてUITableViewコントローラーを含めることに問題はありません。
2 に答える
2
を構成するときに、セルにとをUITableViewCell
追加できます。UIImageView
UILabel
contentView
UITableViewCell *cell = ...;
UIImageView *yourImageView = ...;
UILabel *yourLabel = ...;
[cell.contentView addSubview:yourImageView];
[cell.contentView addSubview:yourLabel];
于 2012-09-08T13:00:09.347 に答える
0
MyCustomTableViewCell
UITableViewセルをサブクラス化し、UIImageViewとUILabelを内部に持つ独自のセルを作成します。
次に、これを実行して、ケースを再利用する際にセルを更新できます。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]
MyCustomTableViewCell *myCell = (MyCustomTableViewCell)cell;
myCell.label.text = newText;
myCell.imageView.image = newImage;
return cell;
}
于 2012-09-08T13:17:45.973 に答える