I wrote the code below to add all the titles of a UILabel for each cell in my tableview, however I am not sure how to proceed. I get errors because of the index part.
Thank you in advance
- (IBAction)addAllCellLabelNamesToList:(UIButton *)sender {
NSMutableArray*selected=[[NSMutableArray alloc]init];
for (int i =0;i<[_mainTable numberOfRowsInSection:0];i++) {
ListCell*cell=[_mainTable cellForRowAtIndexPath:i];//not usre what to put here
if (!cell.isSelected) {//if selected add to array
[selected addObject:cell.ingredientLabel.text];
}
}
}
UITableViewDataSource#tableView:cellForRowAtIndexPath:takes anNSIndexPathparameter, not a simpleint.Try the following code: