0

所以我对我的一个观点有几个部分,例如:

1. My Events
2. My Matches
3. All Events

现在我想在每个部分显示几行(有限制),然后添加另一个指向主视图的单元格。

由于数据将来自 API,我仍然需要将数据分组到三个部分,这很容易,因为我在该实现上有 3 个数组,例如:

@implementation MainOptionsController{
 NSArray *mainHeaders;
 NSArray *myEvents;
 NSArray *myMatches;
 NSArray *allEvents;
}

-(void)ViewDidLoad{
  [super ViewDidLoad];
  myEvents = [NSArray arrayWithObjects:@"My Event 1", @"My Event 2", @"View More" nil];
  myMatches =[NSArray arrayWithObjects:@"My match 1", @"My match 2", @"View More" nil]; 
  allEvents = [NSArray arrayWithObjects:@"Event 1", @"Event 2", @"View More" nil];
}

我已经显示了每个部分的标题,但我的问题是如何在各自的部分上显示数组?

谢谢!

4

1 回答 1

0

Implement the following method in your tableView delegate class

- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;

This method is called from the tableView foreach cell it displays.

于 2013-01-23T15:29:37.820 回答