获取自定义 UISlider 的参考
我已经实现了 UISlider 的自定义类,因此可触摸区域更大,
一切都运行良好,只是现在我想根据应用程序中的其他因素更改初始值。
我拥有的唯一代码从(发送者)获取滑块的 ID,
我需要像这样解决滑块...
slider.value = 25.0;
但我拥有的唯一代码是
-(IBAction) slider1Changed:(id) sender{
UISlider *slider = (UISlider *) sender;
int progressAsInt =(int)(slider.value);
NSLog(@"Slider is %@",slider);
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setInteger:progressAsInt forKey:@"SharedSkilledWorkforce"];
}
在 xib @property (nonatomic,retain) UISlider *slider1; 中未显示为连接
如何处理自定义 UISlider?
I have implemented a custom class of UISlider so the touchable areas are larger
Everything is working great except now I want to change the initial values depending on other factors in the app.
The only code I have gets the slider's ID from (sender)
I need to address the slider like so...
slider.value = 25.0;
But the only code I have is
-(IBAction) slider1Changed:(id) sender{
UISlider *slider = (UISlider *) sender;
int progressAsInt =(int)(slider.value);
NSLog(@"Slider is %@",slider);
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setInteger:progressAsInt forKey:@"SharedSkilledWorkforce"];
}
In the xib @property (nonatomic, retain) UISlider *slider1; doesn't show up as a conncetion
How do I address the custom UISlider?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过将 IBOutlet 添加到 slider1 属性?
这:
需要:
为了出现在 IB 中。 IBOutlet 与 IBAction 类似,是对设计者的提示。
Have you tried adding IBOutlet to your slider1 property?
This:
Needs to be:
in order to show up in IB. IBOutlet is a hint to the designer similar to IBAction.