Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIControlEvents and subclassing UIControl

I have a UIControl subclass for a custom slider type control (one that behaves differently from UISlider). At the moment I use my own target and action variables to send a message to the target whenever the slider value changes. But this doesn't play nice with Apple's UIControlEvent constants. I wasn't sure if I should use these, and if so, where can I put my custom "value changed" detection?

I overrode beginTrackingWithTouch: and continueTrackingWithTouch: to return YES but the action is never dispatched.

like image 900
hyn Avatar asked Aug 05 '09 07:08

hyn


People also ask

What is UIControl?

The user interface domain elements are used to describe the user interface of a software program. uicontrol. The <uicontrol> element is used to mark up user interface controls, such as names of buttons, entry fields, menu items, or other objects that allow the user to control the interface.

What is a view in Xcode?

Overview. Views and controls are the visual building blocks of your app's user interface. Use them to draw and organize your app's content onscreen. Views can host other views.


1 Answers

Every time the value changes you call [self sendActionsForControlEvents:UIControlEventValueChanged] and the control will handle the rest.

like image 121
Ben Stiglitz Avatar answered Sep 20 '22 16:09

Ben Stiglitz