故事板中的组静态tableView不会出现

时间:2012-07-19 07:26:50

标签: objective-c ios xcode uitableview storyboard

在故事板中,当我将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

1 个答案:

答案 0 :(得分:2)

如果在故事板中使用静态表

,则应删除所有这3个
 - (NSInteger)tableView:
 - (UITableViewCell *)tableView:
 - (void)tableView:(UITableView *)