how to handle toogle button on every and each on tableviewcell in iPhone

前端 未结 2 1209
小鲜肉
小鲜肉 2021-01-26 13:35

My code is working fine but it works only for a single cell. When i define 5 rows then it works only for the last cell. If I click on 1 cell then value displayimage

2条回答
  •  失恋的感觉
    2021-01-26 14:08

    Try giving the tag for the button as the row number of the table. Then check the tag in the button press method and then perform the logic to change image.

    -(void)changeMapType:(id)sender
    {
       UIButton *button = (UIButton *)sender;
       // Check tag of button
       // Some code
       //Change image after checking
       [button setImage:yourImage forState:UIControlStateNormal];
    
    }
    

提交回复
热议问题