忍者ブログ
2024 / 09
≪ 2024 / 081 2 3 4 5 6 78 9 10 11 12 13 1415 16 17 18 19 20 2122 23 24 25 26 27 2829 30 2024 / 10 ≫

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。



とりあえずデータを1個セットしてみる。
データを1個セットするにしても変更箇所が3カ所ある。

section の数、テーブルの Cell の数、実際にセットするデータ。

section の数: numberOfSectionsInTableView
Cell の数 : numberOfRowsInSection
データ  : cell.text = @"にんじん";

cell.text = @"にんじん"; ←だけ追加してみた。
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 0;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
cell.text = @"にんじん";
return cell;
}

実行〜
faeb33d0.jpg
何も表示されず・・・f^^;
numberOfRowsInSection の数が 0 なので表示されず・・・

numberOfRowsInSection を 1 にしてみる。


04e647a2.jpg
にんじんが表示された。


次は、section を表示してみる。






PR


この記事へコメントする








絵文字:
Vodafone絵文字 i-mode絵文字 Ezweb絵文字








08 2024/09 10
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
HN:
cow

自己紹介:
iPhone購入がきっかけでiPhoneアプリの制作にチャレンジ!