Change a UILabels text with a UISliders value

前端 未结 3 1926
有刺的猬
有刺的猬 2021-01-14 20:46

How I could show a UISliders value as a UILabels text?

3条回答
  •  深忆病人
    2021-01-14 20:59

    Try this:

    - (IBAction) sliderValueChanged:(UISlider *)sender {  
        label.text = [NSString stringWithFormat:@"%f", slider.value];
    }  
    

    If label and/or slider are IB elements, define IBOutlets and connect them.

    And then connect the slider sliderChanged action to this method.

    Good luck!

提交回复
热议问题