开发者

Button should be visible when the user is done selecting the value through slider

I need to implement such kind of functionality in my slider such that the submit button should not appear till the us开发者_如何转开发er pull up his fingers from slider. Is there any kind of function which can duplicate this.

Thanks,


The UISlider has a continuous property. Set this to NO, and you will only receive valueChanged events when the user is done choosing his value. Then add a target for the valueChanged event, and there you can set the button to be enabled.


If you can't set continuous to NO for some reason, observe the UIControlEventTouchUpOutside and UIControlEventTouchUpInside events:

[yourSlider addTarget:self 
               action:@selector(showSubmit:) 
     forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside];

And

- (void)showSubmit:(UISlider *) {
    // code to show your button here
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜