Questions tagged [uibutton]

UIButton is a subclass of UIView for displaying buttons in iOS. It implements the target action paradigm to send events to the controller layer.

A UIButton intercepts touch events and sends an action message to a target object when tapped. Methods for setting the target and action are inherited from UIControl (). This class provides methods for setting the title, image, and other appearance properties of a UIButton. By using these accessors, you can specify a different appearance for each button state:

  • UIControlStateNormal,
  • UIControlStateHighlighted,
  • UIControlStateDisabled,
  • UIControlStateSelected.
  • UIControlStateFocused.

Resources:

11252 questions
3
votes
6 answers

Difference between UIButton! and UIButton? in swift IOS

Now only i am start working with swift language. I have initialize the button as follows @IBOutlet weak var systemTextButton: UIButton! after that i can set the title using .setTitle() property. If i use ? instead of ! while initialize then showing…
Surfer
  • 1,370
  • 3
  • 19
  • 34
3
votes
1 answer

If I add a background color to a UIButton, how do I inset it so the background is smaller?

If I have a UIButton and give it a red background, and the background size is a little too small or too big for my liking (but the tap target size is perfect), is there any way to change the size of them? Basically the equivalent of adding padding…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
3
votes
1 answer

Why does my UIButton.titleLabel.text disappear when I place an image in the button?

I've had this problem before but was able to work around it until now, Basically I'm creating a custom UIbutton setting its image as a uiimage and then the button that has had a label until I implimented the below code now loses its label. I need…
nickthedude
  • 4,925
  • 10
  • 36
  • 51
3
votes
2 answers

Add and decrease time with UIButton to Timer

Hello everyone i have a question how i can add and decrease time with UIButton to timer for example if i will have button with minus and plus and time at timer. Thank you.
Tcacenco Daniel
  • 445
  • 7
  • 17
3
votes
3 answers

UIButton with multiple actions: How to prevent other actions from firing

I'm trying to find a way to consume a button press, not from the response chain per se, but from other action methods bound to that button. I've looked all over for this solution and have been unable to find it. For example, lets say I set up a…
zunkination
  • 31
  • 1
  • 5
3
votes
1 answer

Show a popover for a UIButton in a static UITableViewCell

I have a popover when I tap on a UIButton. This button is in a static UITableViewCell. Howeever when I tap on the button, the popover isn't where I would think it should, under the UIButton. Because it's a static cell I am not using…
Paul S.
  • 1,342
  • 4
  • 22
  • 43
3
votes
0 answers

uibutton with png cause uiscrollview to lag

I have an UIScrollView with 15 UIButton (create with a storyboard) When I zoom or Scroll it's laggy. the trace for a scroll is : Running Time Self Symbol Name 434.0ms 100.0% 0,0 Main Thread 0x61091 434.0ms 100.0% 0,0 …
amau96
  • 857
  • 1
  • 8
  • 19
3
votes
3 answers

Why is UIBarButtonItem image always fuzzy/blurry/pixelated

Here is my current code: var reply = UIBarButtonItem(image: UIImage(named: "reply"), style: UIBarButtonItemStyle.Plain, target: self, action: Selector("reply:")) self.navigationItem.rightBarButtonItem = reply The button in the top right corner is…
Mate Hegedus
  • 2,887
  • 1
  • 19
  • 30
3
votes
2 answers

UIButton Press/Release Animation Oddly Inconsistent

I'm trying to write a custom UIButton subclass that will "animate" during press and release. When pressed, the button should "shrink" (toward its center) to 90% of its original size. When released, the button should "expand" to 105%, shrink again to…
mbm29414
  • 11,558
  • 6
  • 56
  • 87
3
votes
3 answers

UIButton image position depends on the frame of titleLabel

My issue is pretty simple yet I can't find a solution. I have a UIButton which has a title and image. I want image position to be fixed no matter what happens so I set it this way: [button setImageEdgeInsets:UIEdgeInsetsMake(0.f, 0.f, 0.f, IS_IPHONE…
Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
3
votes
1 answer

iOS 7 custom keyboard UIView touch down event delayed in bottom row

here's an odd one.. I've got a UIView xib file that looks like this: I've connected every UIButton touchDown and touchUpInside events to two IBAction methods: - (IBAction)touchUpInside:(id)sender { NSLog(@"touch up inside"); if (((UIButton…
JackyJohnson
  • 3,106
  • 3
  • 28
  • 35
3
votes
2 answers

Adding UIButton Programmatically won't show

I'm currently making an iOS 8 application ready for the app store upon iOS 8 release, I don't obviously I cannot show much code as I'm keeping the project very quiet but I am creating a view controller with a scroll view and many objects throughout…
Zach Ross-Clyne
  • 779
  • 3
  • 10
  • 35
3
votes
1 answer

Creating subviews in UIView subclass in swift

i have this code for the UIView subclass. import UIKit class DrawingSquareView: UIView { override func drawRect(rect: CGRect) { var apertureRect : CGRect = CGRectMake(80, 200, 160 , 158) var context : CGContextRef =…
Alvin Varghese
  • 842
  • 10
  • 33
3
votes
4 answers

Set the title of a UIButton with a single method invocation?

I'd like to set the title of a UIButton via code. I find myself having to call -[UIButton setTitle:forState:] for UIControlStateNormal, UIControlStateHighlighted, UIControlStateDisabled, UIControlStateSelected. And that doesn't even take into…
Greg Maletic
  • 6,225
  • 8
  • 54
  • 73
3
votes
1 answer

UIButton Label Resets When Clicked Inside A TableViewCell

I have a custom tableview cell, when I click the "quantity button" inside the cell, the value of the cell itself resets to the value defined the prototype cell on storyboard (which is "1"). So imagine I click the button under the image of the first…
blee908
  • 12,165
  • 10
  • 34
  • 41