如何获取两个滑块滑动时的值?
我的视图中有两个滑块,我希望在滑动每个滑块时获得这两个值。 但每当我尝试执行此操作时,另一个不滑动的滑块的值就会变为零,并且实际上我只得到一个值。
这就是我所做的,
- 为每个滑块创建两个 IBAction
为每个滑块创建两个属性
@property(保留,非原子)IBOutlet UISlider * slider2;
-(IBAction)slidingN:(id)发送者 { UISlider * si = (UISlider *) 发送者; int 值 = (int) si.value; NSString * newText = [[NSString alloc] initWithFormat:@"%i" , value]; myLable.text = newText; int valueD = (int)slider2.value; [自我调用SubView:值:valueD]; }
但值是 0 我怎样才能同时拥有这两个值?
I have two sliders in my view and I want to get both value when I slide each one .
but whenever I try to do this the value of the other slider which is not sliding becomes zero and literally I get only one value.
this is what I have done
- create two IBAction for each slider
create two property for each slider
@property (retain , nonatomic ) IBOutlet UISlider * slider2;
-(IBAction) slidingN : (id) sender { UISlider * si = (UISlider *) sender; int value = (int) si.value; NSString * newText = [[NSString alloc] initWithFormat:@"%i" , value]; myLable.text = newText; int valueD = (int)slider2.value; [self callSubView:value :valueD]; }
but the value is 0 how can I have both values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重新启动 Xcode 后问题解决(非常好)
Problem Solved (surpassingly) after restarting Xcode