1

在情节提要中,当我将 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
4

1 回答 1

2

如果您在情节提要中使用静态表,则应删除所有这 3 个

 - (NSInteger)tableView:
 - (UITableViewCell *)tableView:
 - (void)tableView:(UITableView *)
于 2012-07-19T09:45:38.880 回答