3

と の XIB がUITableViewありUITableViewCellます。

このセルをcellForRowAtIndexPathの tableView に接続するにはどうすればよいですか?

編集済み

ここに画像の説明を入力

編集済み

このセルの上にあるtableViewの画面のセルを使用したいだけです。ラベルを 1 つだけ表示する必要があるため、クラスを作成したくありません

みんなに感謝

4

8 に答える 8

0

デリゲートとデータソースを tableviewView に設定する必要があります。

それは2つの方法で作ることができます。

1) ビュー コントローラーが UITableViewController の場合は、TableViewDatasource を見つけて xib にデリゲートし、ファイルの所有者にタグ付けします。

2) それ以外の場合 UIViewController を使用する場合..

あなたの.hファイルで

@interface YourViewController<UITableviewDelegate,UITableviewDatasource>

ビューでDidload。

self.tableView1.delegate = self;
self.tableView1.datasource = self;
于 2013-05-08T09:44:21.277 に答える
0
static NSString *cellIdentifier = @"currencyCellIdentifier";

    // Try to retrieve from the table view a now-unused cell with the given identifier.
    CurrencyTableCell *cell = [tableView1 dequeueReusableCellWithIdentifier:cellIdentifier];
    // If no cell is available, create a new one using the given identifier.

    if (cell == nil)
    {
        // Use the default cell style.
        cell = [[CurrencyTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CurrencyTableCell"
                                                     owner:self options:nil];
        cell = [nib objectAtIndex:0];

    }
于 2013-05-08T09:42:58.620 に答える