ストーリーボードで、グループ セルが表示されないストーリーボードに tableView クラスを追加すると、4 行を含む静的グループ テーブル ビューを作成します。
助けてください(私はiOSが初めてなので、コードを教えてください)
前もって感謝します!
これがtableViewクラスのコードです
#import "CheckedInOut.h"
@interface CheckedInOut ()
@end
@implementation CheckedInOut
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *menuButton= [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleDone
target:self action:@selector(menu:)];
UIBarButtonItem *yearButton= [[UIBarButtonItem alloc] initWithTitle:@"Year" style:UIBarButtonItemStyleDone
target:self action:@selector(year:)];
UIBarButtonItem *weekButton= [[UIBarButtonItem alloc] initWithTitle:@"Week" style:UIBarButtonItemStyleDone
target:self action:@selector(week:)];
UIBarButtonItem *reportButton= [[UIBarButtonItem alloc] initWithTitle:@"Report" style:UIBarButtonItemStyleDone
target:self action:@selector(report:)];
NSArray *buttons = [NSArray arrayWithObjects:menuButton,yearButton,weekButton,reportButton,nil];
self.navigationItem.rightBarButtonItems = buttons;
}
- (void)viewDidUnload
{
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 4;
}
ここに何を書いて返せばいいのかわからない
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [myArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
return cell;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
}
@end