I have a table with 2 rows with each 3 columns in it and an Array with 5 values. These values should be displayed successively in the 3 columns, e.g.
indexPath.row 0: Array[0] | Array[1] | Array[2]
indexPath.row 1: Array[3] | Array[4] |
I want to create some coding, which puts my values (it doesn’t care how much e.g. 5,6,7,…,20,21 in the format of 3 columns in rows) the rows are calculated at the size of the array with the values.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSMutableArray *values = [... getValues];
int no=0;
if (values) {
no=(values.count+1)/3;
}
else{
no=0;
}
return no;
}
My current problem is, I don’t get the 5 values distributed in the columns.
I’m struggeling around with the calculation, these won’t fit with the index of the array …
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//order values in 3 columns and 2 rows (currently)...
}
BR,
mybecks
Found a solution.