im trying to change the table view cell labels when i change to a different section on the segment control, however changing the segments seams to do nothing, any help would be appreciated
- dragged segment control to the nav controller via storyboard
- made an iboutlet property and linked it to the segment controller
- added the code below to my viewDidLoad
[segmentedControl addTarget:self action:@selector(cycleButton:)
forControlEvents:UIControlEventValueChanged];
4 added this method
- (void)cycleButton:(id)sender {
CustomCell *cell = [[CustomCell alloc]init];
SSVCYLY *cellLabel = [[SSVCYLY alloc]init];
if (self.segmentedControl.selectedSegmentIndex == 0) { //Total
NSLog(@"Total Selected");
cell.dum.text = [NSString stringWithFormat:@"Total: %@", cellLabel.TOTAL];
//cell.dumcc.text =
cell.vdum.text = [NSString stringWithFormat:@"VTotal: %@", cellLabel.VTOTAL];
//cell.vdumcc.text =
cell.ldum.text = [NSString stringWithFormat:@"LTotal: %@", cellLabel.ltotal];
//cell.ldumcc.text =
} else (self.segmentedControl.selectedSegmentIndex == 1) { //Bakery
NSLog(@"Bakery Selected");
cell.dum.text = [NSString stringWithFormat:@"Bak: %@", cellLabel.BAK];
cell.dumcc.text = [NSString stringWithFormat:@"Bakcc: %@", cellLabel.bakcc];
cell.vdum.text = [NSString stringWithFormat:@"VBak: %@", cellLabel.VBAK];
cell.vdumcc.text = [NSString stringWithFormat:@"VBakcc: %@", cellLabel.VBAKCC];
cell.ldum.text = [NSString stringWithFormat:@"LBak: %@", cellLabel.lbak];
cell.ldumcc.text = [NSString stringWithFormat:@"LBakcc: %@", cellLabel.lbakcc];
}
NSLog shows what segment ive selected, but the tableview cells dont change at all.
Did you add Target to segmentedControl?
then