0

UITableView多くのクラス名 (1A、1B、2A...)を持つNSMutableArrayがあり、行のテキストの前に画像を表示したいと考えています。セル内のテキストが 1A に = の場合、どのように 1A 画像を表示できますか? アイデアやコード例はありますか?

この世界ではかなり新しいので、どうもありがとう:D

4

2 に答える 2

0

これはあなたが意味するものですか?

http://www.appcoda.com/customize-table-view-cells-for-uitableview/

はいの場合、上記のリンクは、独自のテーブルビューセルを作成する方法に関するチュートリアルを提供します。そのようなセルを作成するときに、nsstring、uiimage、または各テーブルビューセルに表示されるものが必要な場合は、自分で提供できます。

于 2012-09-10T19:30:16.830 に答える
0

方法は次のとおりです。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

  static NSString *cellIdentifier = @"Cell";

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier];

if (cell == nil) {
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Identifier];
}

//This piece of code will allow you to display your images beside your text in the tableView

cell.imageView.image = [UIImage imageNamed:[self.classNameArray objectAtIndex:indexPath.row]];

}

これが役に立てば幸いです。:) 乾杯

于 2014-11-15T05:02:37.733 に答える