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
9
votes
4 answers

Prevent touch events on subviews of scrolling UIScrollView in iOS7

I have a UIControl inside a UIScrollView. In my UIControl's init, I rig up some touch event handlers, e.g. [self addTarget:_delegate action:@selector(touchedDown) forControlEvents:UIControlEventTouchDown]; iOS6 and iOS7 behave differently…
Emmett
  • 14,035
  • 12
  • 56
  • 81
8
votes
3 answers

Since Updating to xcode 12 I am not able to place any UIControl inside UITableViewCell

I have a search form that uses a tableview. After updating Xcode 12 today the UISwitch, UITextField, UISlider no longer work when nested inside a UITableViewCell. Is there a property that has changed that I need to set to make this work again? To be…
Jason F
  • 309
  • 4
  • 11
8
votes
1 answer

Custom UIControl gets touchesCancelled when scrolling; how do I disable scroll?

I'm writing a UISwitch replacement (with custom graphics). I've overridden touchesMoved and friends, so that you can drag the widget between Yes and No, just as with UISwitch. If you place it in a scroll view, touches will be cancelled if the user…
nevyn
  • 7,052
  • 3
  • 32
  • 43
8
votes
4 answers

Managing events on a custom UIControl

I am subclassing UIControl to compose a custom control that contains different standard controls. For this discussion let's assume that my custom UIControl contains a UIButton only. What I would like to achieve is that clicking anywhere in the…
Beav
  • 495
  • 2
  • 5
  • 14
8
votes
2 answers

UIControll in UIScrollView not receiving touch events

I use SevenSwitch in my project. I need to add it into a UIScrollView but it seems that the control can not receive touch events when I add it into scroll view. I tried sub classing scrollview and overriding below code: -…
Husein Behboudi Rad
  • 5,434
  • 11
  • 57
  • 115
8
votes
4 answers

How to implement range slider in Swift

I'm trying to implement Range Slider and I used custom control called NMRangeSlider. But when I use it, the slider doesn't appear at all. Could it be also because it's all written in Objective-C? This is how I've currently implemented it: var…
Rawan
  • 1,589
  • 4
  • 23
  • 47
7
votes
3 answers

Matlab: Something like "relative" position with uicontrol/axis; keep fixed margins when resizing

I currently have a big headache to get a small GUI working nicely which isn't being created with GUI editor but programmatically! What I have so far is something like the following: hFig = figure(); set(hFig, 'Position', [300 200 500…
tim
  • 9,896
  • 20
  • 81
  • 137
7
votes
1 answer

iPhone - what controls needed for a chat style app? (easy question)

In a portion of my app I need to make a chat between two users... I know how to send the messages between both but I don't know what are the best controls I have to use in the UI... I want a UI similar to WhatsApp(simple and very good looking) For…
Pittor
  • 119
  • 1
  • 9
7
votes
2 answers

Custom UIControl subclass with RxSwift

I am creating a custom subclass of UIControl (I need to override its draw method) and I want to add RxSwift to bind its isSelected property to my model. So far so good. This works fine. My problem is how can I do to change the value isSelected…
t4ncr3d3
  • 615
  • 1
  • 8
  • 17
7
votes
3 answers

Touches on transparent UIControl are ignored - not handled by added action functions

I have a custom UIControl that contains a few other controls. In between those controls there is empty space and background of my UIControl needs to be transparent. I need to catch all touch events that happen on my custom UIControl even if they…
Rasto
  • 17,204
  • 47
  • 154
  • 245
7
votes
4 answers

UIControl endTrackingWithTouch not called

I have a view with a tap gesture recognizer. A subview of this view is an instance of my custom class, which inherits from UIControl. I am having an issue where the UIControl subclass will sometimes allow touch events to pass through to the parent…
jeremywhuff
  • 2,911
  • 3
  • 29
  • 33
7
votes
3 answers

Reason for - (void)cancelTrackingWithEvent:(UIEvent *)event getting called If I am using MSSlideNavigationController?

I tried to use custom UIControl in my view controller. My custom class which subclasses the UIControl and allocate the instance for my custom control and adding in to my view controller's view by following code CustomControl *customControl =…
jailani
  • 2,260
  • 2
  • 21
  • 45
6
votes
2 answers

Setting Background Image Programmatically In A Xib

I have a XIB file with UIControl and UIScrollView elements inside of it. I would like to add a background image to the view. I tried adding an ImageView in IB but I could not get it to be present as a background and it obscured the control elements.…
Andrew Lauer Barinov
  • 5,694
  • 10
  • 59
  • 83
6
votes
2 answers

How can I mimic a user click to invoke a callback function for a GUI object?

I'm trying to programmatically create a click event in MATLAB that will mimic the user clicking on a GUI object. The callback function for the object is a subfunction, so I can't call it directly. However, I am able to get the callback property from…
Anny
  • 63
  • 1
  • 3
6
votes
2 answers

How to lock designable size of custom UView

I am making a custom activityIndicator. I wanted it to behave like UIActivityIndicatorView but with different animations. When you place UIActivityIndicatorView to Storyboard the width and height of this view are locked for modification (grayed…
Thorax
  • 2,352
  • 1
  • 22
  • 27
1
2
3
29 30