我试图更改表视图单元格标签,当我更改为段控件上的不同部分,但是更改段接缝什么都不做,任何帮助将不胜感激
[segmentedControl addTarget:self action:@selector(cycleButton:)
forControlEvents:UIControlEventValueChanged];
4添加了此方法
- (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显示我选择的片段,但是tableview单元格根本没有变化。
答案 0 :(得分:0)
您是否将Target添加到segmentedControl?
[segmentedControl addTarget:self
action:@selector(actionMethod:)
forControlEvents:UIControlEventValueChanged];
然后
- (void)actionMethod:(id)sender
{
//reload your table
}