UISegmentedControl selected state icon image

后端 未结 6 1672
执笔经年
执笔经年 2021-02-20 07:54

How can I set the icon image for selected state of the UISegmentedControl. Is the UISegmentedControl really missing this functionality or

6条回答
  •  余生分开走
    2021-02-20 08:37

       [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
    
    -(void)segmentAction:(UISegmentedControl*)sender {
    
        [sender setImage:[UIImage imageNamed:@"image.png"] forSegmentAtIndex:sender.selectedSegmentIndex];
    
    }
    

提交回复
热议问题