开发者

UISlider's value is not shown by UILabel

In my app, I have a Settings view, where the user can use UISlider to set value from 50 to 1000. The selected value is then shown in a UILabel.

The problem is that the label does not display at all. The Action and the IBOutlets are connected in IB. The NSLog displays the value correctly on the console.

I can't figure out what is going on....help is needed :)

I have the following:

    IBOutlet    UILabel  *sliderLabel;
    IBOutlet        UISlider *slider;
    ...
    @property (nonatomic, retain) UILabel *sliderLabel;
    @property (nonatomic, retain) UISlider *slider;

    -(IBAction) sliderValueChanged:(id) sender;

and

   @synthesize sliderlabel, slider;


   - (IBAction) sliderValueChanged:(UISlider *) sen开发者_StackOverflowder {
        NSString *sliderValue = [NSString stringWithFormat:@"%d feet",(int)[sender value]];
        NSLog(@"%@", sliderValue);
        [[self sliderLabel] setText: sliderValue];
   }

Thanks, and regards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜