所以我的视图中有这个滑动器, 它最多有13分和1分。 取决于您如何移动滑动滑动器, 数字的变化, 并且可以显示在标签上, 标签上显示滑动器正在打开的当前数字 。
我希望能够将滑动器的内注从滑动器转换为字符串; 所以如果滑动器的进展是 13, 我希望标签能读“ A+”, 12 加上“ A” 11 加上“ A - ” 等。
不必做13个“ 如果” 语句, 因为我有不止一个滑动符, 是否有方法来检查滑动符的进度, 然后将数字转换为所需的字母等级?
这是我的一个滑动符的代码
-(IBAction)sliderChanged:(id)sender{
UISlider *slider = (UISlider *)sender;
int progress = (int)roundf(slider.value);
c1Grade.text = [NSString stringWithFormat:@"%d",progress];
}
// c1Grade is the label next to the slider showing the progress