Questions tagged [uicontrol]

In iOS UIKit, UIControl is the base class for control objects such as buttons and sliders.

Available in iOS 2.0 and later in UIKit. The main role of UIControl is to define an interface and base implementation for preparing action messages and initially dispatching them to their targets when certain events occur.

The UIControl class also includes methods for getting and setting control state—for example, for determining whether a control is enabled or highlighted—and it defines methods for tracking touches within a control. These tracking methods are overridden by UIControl subclasses.

You cannot use the UIControl class directly to instantiate controls. It instead defines the common interface and behavioral structure for all its subclasses.

440 questions
5
votes
1 answer

Create ControlProperty for custom UIControl

Is it possible to make extension of structure Reactive, where base class is my custom control inherited from UIControl? When I'm trying following code: extension Reactive where Base: CustomControl { public var value: ControlProperty
Dmitriy Stupivtsev
  • 832
  • 1
  • 8
  • 17
5
votes
1 answer

Why is a UIButton consuming touches but not a UIControl

I have some custom buttons in a table view cell. These buttons are contained by another view which does not take up the whole cell. I want the buttons to always respond to taps (and consume the tap so that the cell is not selected at the same…
Rupert
  • 2,097
  • 19
  • 28
5
votes
3 answers

UIButton addTarget:action:forControlEvents: results in [NSObject doesNotRecognizeSelector:]

I tried a lot of stuff, still no result. So I have the following button created programatically in a subclass of UIViewController: rightButton = [UIButton buttonWithType:UIButtonTypeCustom]; rightButton.frame = CGRectMake(0.0, 0.0, 110.0,…
Teodor
  • 181
  • 1
  • 1
  • 6
5
votes
2 answers

Custom UIControl with UILabel dimming on tint color change

In case of UISegmentedControl, once a popover or alert is present, the Control dims to grey (desaturates the tint color) I'am building my own UIControl subclass, which uses a UILabel as a subview i want to dim (desaturate) the text color of the…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
5
votes
2 answers

UIControl: sendActionsForControlEvents omits UIEvent

I want to implement a custom subclass of UIControl. It works beautifully except for one fatal problem that is making me spit teeth. Whenever I use sendActionsForControlEvents: to send an action message out, it omits to include a UIEvent. For…
Ash
  • 9,064
  • 3
  • 48
  • 59
4
votes
3 answers

UIControl Subclass - Events called twice

I'm currently working on a custom UIControl Subclass. To track the touches I use the following Method: - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { NSLog(@"Start"); CGPoint location = [touch locationInView:self]; …
Sandro Meier
  • 3,071
  • 2
  • 32
  • 47
4
votes
3 answers

Custom UIControl slider doesn't work when embedded in iOS13 modal viewController

When I embed a custom UIControl inside a ViewController that's presented modally with the new iOS13 automatic style, touchesCancelled is called whenever a pan gesture moves more than a few points. The native UIKit UISlider doesn't do this. You can…
thattyson
  • 718
  • 8
  • 17
4
votes
1 answer

Assign Default Action to all UISlider programmatically

My app is in prototype stage of development. Some sliders do not have any action assigned to them either through storyboard or programmatically. I need to display an alert when slider drag stops during testing. Can this be done through an extension…
nkirit
  • 379
  • 2
  • 4
  • 13
4
votes
2 answers

UIControl subclass is unable to take a target?

I've subclasses UIControl and in it I am sending: [self sendActionsForControlEvents:UIControlEventValueChanged]; When I create an instance of the object, I add a target as follows: [starView addTarget:self action:@selector(starRatingChanged:)…
RyanJM
  • 7,028
  • 8
  • 60
  • 90
4
votes
5 answers

Pull Menu in CocoaTouch

I am attempting to make a UIView/UIControl that people can drag up and reveal a text box, and then drag down to hide it. However, I have yet to find a method to make this "fluid" - it always seems to stop at random places and doesn't allow any more…
individualtermite
  • 3,615
  • 16
  • 49
  • 78
4
votes
3 answers

How do I add UIControls to a UIScrollView contentView?

I want to add UIControls to a UIScrollView, eg. UIControl *couponView = [[UIControl alloc] initWithFrame:CGRectMake(drawX,drawY,couponWidth,couponHeight)]; couponView.backgroundColor = [UIColor redColor]; [[scrollView contentView]…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
4
votes
1 answer

What is the purpose of UIControl.sendAction's selector?

What is the purpose of UIControl.sendAction's selector argument? It makes sense that UIControl.addTarget takes the selector argument that represents the function that is to be called when an action is sent, but why would the controller that's…
4
votes
1 answer

Forward event from custom UIControl subclass

My custom subclass extend UIControl (EditableImageView) Basically it contains 3 subviews: UIButton (UIButtonTypeCustom) UIImageView UILabel All the class works great but now I want to connect some events generated from this class to another. In…
ggould75
  • 880
  • 2
  • 14
  • 23
4
votes
7 answers

How to set a UIButton as both Selected and Disabled

Attempting to toggle both the selected and enabled attribute on a UIButton, therefore creating 4 potential states (Selected & Disabled, Selected & Enabled, Unselected & Disabled, unselected & Enabled). In viewDidLoad I define the the images for the…
user1905842
  • 165
  • 1
  • 13
4
votes
3 answers

iPhone UIControl and Subview

I currently have a UIControl, which has a number of subviews (image, label). Unfortunately when I use addTarget etc. It doesn't detect touches on the subviews. [myCustomView addTarget:self action:@selector(touchedView:) …
Jack Thompson
  • 41
  • 1
  • 2
1 2
3
29 30