まず、UITableView をflipsideViewController
インターフェイス ビルダーにドラッグ アンド ドロップします。ビューコントローラーへのデリゲートとデータソースが適切であることを確認してください。

次にflipsideViewController.h
、セル ラベルのテキストを格納する配列のインスタンス変数を作成し、コントローラがテーブルのデリゲート メソッドとデータ ソース メソッドに準拠するように変更します。
@interface FlipsideViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
{
NSArray *myArrayOfItems;
}
flipsideViewController.m
alloc/init で、配列にデータを入力しますviewDidLoad
myArrayOfItems = [[NSArray alloc] initWithObjects:@"firstItem",@"secondItem",@"thirdItem",@"fourthItem", nil];
最後に、以下をコピーして貼り付けると、作業テーブルが作成されます!
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [myArrayOfItems count];
}
- (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];
}
cell.textLabel.text = [myArrayOfItems objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Selected cell index:%i",indexPath.row);
}