I have a tableview where i return the no of sections and no of rows for each sections dynamically. I can implement it like this
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if( section == 0)
return [array count];
if( section == 1)
return [array2 count];
if( section == 2)
return [array3 count];
}
if i am aware that i have 3 sections i can do it in this above mentioned way. But how to dynamically define the no of rows for different sections. e.g:- u have if(section == 0). i dont want to hard code the value of 0,1,2 here. I am not sure about the total no of sections. How can we do it we want to return the no of rows dynamically for different sections? I have an array to display no of sections and different arrays to display no of rows for each section. How to dynamically mention in the method “numberOfRowsInSection”?
here you can follow this approach , you can put all your countable arrays in another
NSMutableArraylike lets say tmpArray (e.g.tmpArray[0] = arrayortmpArray[1] = array2, or just by appending[tmpArray addObject:array] ..),then you can go like this
i hope this will help you to solve your problem ..