Questions tagged [uicontrolstate]

31 questions
1
vote
1 answer

How to have custom UIControlState in Swift 2.2 using bit masks?

I have a custom UIButton with some unique states that I want it to have like: enum PositionControlState : Int { case Available = 0, Pending, Waiting, Approved, Declined } I've done a bit of Googling and found some stuff about bitmasks, and…
eli_slade
  • 419
  • 1
  • 4
  • 12
1
vote
3 answers

UITableViewCell does not hold the state of custom button

I have read through similar questions but I haven't been able to solve it. I have a tableview which has a custom cell with a button to add and remove a class. I created a custom delegate to save and remove the class, and to change the state of the…
Gama
  • 352
  • 2
  • 16
1
vote
2 answers

Change text color of buttons from black to white and then revert back

I have ten buttons in a slide out menu. How do I change the text color of the ten buttons from black to white by selection and then revert back to the original state when a user clicks on another button. I am looping through the buttons one by one…
Nick
  • 37
  • 10
1
vote
1 answer

UIButton disabled state not changing immediately

I have a UIButton setup which I wanted to use as a way to tell the user something was happening instead of using a loader just for this one instance. So for example the UIControlStateNormal has: Background Green Title text white Title - Click to…
StuartM
  • 6,743
  • 18
  • 84
  • 160
1
vote
0 answers

Does android have UIControlStateHighlighted like iOS

iOS has UIControlStateHighlighted. I want to do like this in Android; but I don't want to use two drawable use selected/forced. Do anyone know how do it? Thanks.
Mr.Jie
  • 26
  • 5
1
vote
4 answers

Disabled buttons not changing image in

I have a button that pushes to a settings viewController. On that settings viewController I has a switch to invert all the colors on the original view, an inversion which I've done programmatically. I made inverted button images to replace the…
MScottWaller
  • 3,321
  • 2
  • 24
  • 47
0
votes
1 answer

Overriding isHighlighted still changes UIControlState - why?

In a UIControl, if I override isHighlighted to set a private _isHighlighted property, and then check the control's state to see if it contains .highlighted, the state still accurately reflects the change. See code below. My question is, how is this…
MH175
  • 2,234
  • 1
  • 19
  • 35
0
votes
2 answers

Custom button not changing text color when selected

I have created 3 custom buttons using for loop. But when I select a button the text color is not changing.How do I do it? What else I have to add? Here is my Code buttonText = [[NSArray alloc]initWithObjects:…
Zeen
  • 35
  • 2
  • 8
0
votes
0 answers

Error in Matlab's uicontrol

I am implementing uicontrol in matlab as below: for m = 1: 10 uicontrol(Fig_handle,'Style', 'pushbutton',... 'String', sprintf('%s', ImgNames{m,2}),... 'Tag', sprintf('%s', ImgNames{m,2}),... 'Value', 0, 'Min',0, 'Max',1,... …
Mojo Jojo
  • 369
  • 3
  • 11
  • 31
0
votes
1 answer

UIWindow addSubview handle events

I want to build a custom alert by UIViewController and add its view as a subview to the current window. The view displays very well, but I can't handle any touch events. I have tried many times to add a button to this viewcontroller and add a…
Castiel
  • 35
  • 8
0
votes
1 answer

How to change the title and action of a programmatically created UIButton on some condition

I have created a UIButton programmatically on my ViewController. I want to perform different actions on the same button depending on the condition and want to change the title as well. First I create the button like this: func…
user1hjgjhgjhggjhg
  • 1,237
  • 4
  • 15
  • 34
0
votes
3 answers

UIControlState in Swift

Here is my code: let font = UIFont(name: "AvenirNext-Regular", size: 16.0) let attributes: NSDictionary? = [ NSFontAttributeName : font! ] self.segmentedControl.setTitleTextAttributes(attributes, forState:.Normal) I have an error "Could not…
Maria
  • 755
  • 1
  • 11
  • 29
0
votes
3 answers

UIButton Multiple Labels Using UIControlStates

I know with a UIButton, I can add additional UILabels as subviews: [myButton addSubview: myLabel]; And (at least, with the default title label) I can set its text color when tapped by using: [myButton setTitleColor:someColor…
Connor Neville
  • 7,291
  • 4
  • 28
  • 44
0
votes
2 answers

UIButton sender.titleLabel?.text?.toInt() gives not updated value when pressed too fast

In my application I'm pressing the button and it changes the backgroundcolor and the like number with an iOS default button animation. The default behaviour of the button is like number can only be in the interval [x, x+1] or [x-1, x] where x is the…
Thellimist
  • 3,757
  • 5
  • 31
  • 49
0
votes
1 answer

UIButton textColor for UIControlStateHighlighted in iOS8 issue

I always set the UIColor of highlighted UIButton with: [button setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted]; But in iOS8 it doesn't work for me (and setting the UIColor in storyboard doesn't work too). But this code works…
Paul T.
  • 4,938
  • 7
  • 45
  • 93