Below is a code and towards end, I am trying to figure out the method to count the number of rows in section
The NS Object Definition
//DataDefinition.h
#import
@interface DataDefinition : NSObject
@property (nonatomic, retain) NSString *dataHeader;
@property (nonatomic, retain) NSMutableArray *dataDetails;
@end
The Display header section
//DataDisplay.h
#import
#import "DataDefinition.h"
@interface DataDisplay : UITableViewController
@property (read write) NSInteger RowsCount;
@property (strong, nonatomic) NSMutableArray *dataSet;
@property (strong, atomic) DataDefinition *individualData;
@end
The Display implementation section
//DataDisplay.m
@interface DataDisplay ()
@end
@implementation DataDisplay
@synthesize RowsCount;
@synthesize dataSet;
@synthesize individualData;
- (void)viewDidLoad
{
[super viewDidLoad];
individualData.dataHeader = @"Header1";
individualData.dataDetails = [[NSMutableArray alloc] initWithObjects:@"Header1-Detail1", @"Header1-Detail2", @"Header1-Detail3", nil];
RowsCount = [individualData.dataDetails count];
[dataSet addObject:individualData];
.
.
.
[dataSet addObject:individualData];
self.title = @"DataDisplay";
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return [dataSet count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in sections.
return ?????
}
First if you don’t have section in the dataset you want to display you don’t have to implement this method. You need otherwise to store your data in an NSMutableArray which will be an array of array: this will basically store your content per section.
You can then imagine access to your number of items per section this way:
EDIT
According to your source code and from the discussion we have your code should be: