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

iPhone UIButton with UISwitch functionality

Is there either a way to implement UISwitch with custom graphics for the switch-states? Or as an alternative the other way round, an UIButton with UISwitch functionality?
scud
  • 1,147
  • 1
  • 14
  • 25
61
votes
1 answer

How to create a circular button in Swift?

I want to make a circular thumbs up and thumbs down button. Should I use a ImageView or a Button as the super class? How would I do this in Swift?
User
  • 23,729
  • 38
  • 124
  • 207
60
votes
8 answers

How do we create a bigger center UITabBar Item

I am wondering how do we create a bigger center UITabBar like the shot below? Its really beautiful!!!!
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
60
votes
2 answers

What is the difference between Highlighted and Selected UIButton's State?

Can anyone tell me What is the difference between Highlighted and Selected state of a UIButton?
Jamal Zafar
  • 2,179
  • 2
  • 27
  • 32
60
votes
14 answers

Why is my UIButton.tintColor not working?

My build target is set for IOS5 which is where I understand UIButton.tintColor was introduced... I have this in my viewDidLoad for the View Controller [timelineButton setTintColor:[UIColor blackColor]]; [timelineButton setTitle:@"test"…
sayguh
  • 2,540
  • 4
  • 27
  • 33
58
votes
7 answers

UIButton touch is delayed when in UIScrollView

I'm running into a small issue in my app. I essentially have a series of UIButtons added as subviews in a UIScrollView which is part of a nib. Every time I tap on a button there is a noticeable delay before the button is highlighted. I essentially…
Jeff
  • 2,818
  • 3
  • 29
  • 31
58
votes
11 answers

Why does a custom UIButton image does not resize in Interface Builder?

Why does a custom UIButton image not resize with the button? I set its view mode to Scale to Fill in Interface Builder, but unlike a UIImageView image, it doesn't respect that setting. Am I looking in the wrong place or is it not possible?
willc2
  • 38,991
  • 25
  • 88
  • 99
57
votes
11 answers

UITableViewCell expand on click

Lets say we have a custom UITableViewCell So whenever I click custom button on cell.. it should expand to the some extent (you can say 40 height more...) and when i click again to the same custom button it should collapse to the previous…
Tariq
  • 9,861
  • 12
  • 62
  • 103
56
votes
25 answers

How to change the tint color of the clear button on a UITextField

I have an auto-generated clear button on my UITextfield, with the default blue tint color. I cannot change the tint color to white. I have tried modifying the storyboard and code without success, and I do not want to use a custom image. How can I…
Niels Robben
  • 1,637
  • 4
  • 17
  • 24
54
votes
12 answers

How do I set UIButton background color forState: UIControlState.Highlighted in Swift

I can set the background color for a button but I can't work out how to set the background color for UIControlState.Highlighted. Is it even possible? or do I need to go down the setBackgroundImage path?
David Wood
  • 1,319
  • 2
  • 12
  • 15
54
votes
8 answers

iOS Buttons - add border

I am making my app ready for iOS7. I did conversion and was working with a user. The button in the app does not look like button. Looks very flat. Is there someway to put border or make it stand like a button?
user1509593
  • 1,025
  • 1
  • 10
  • 20
53
votes
6 answers

How can I create a big, red UIButton with iOS?

Using iOS, how would I go about creating a red "delete" button similar to the one used when deleting contacts on the iPhone?
igul222
  • 8,557
  • 14
  • 52
  • 60
52
votes
12 answers

How do I prevent a button's background image from stretching?

I'm allocating a UIButtonTypeCustom to a UIView with a background image that is smaller than the button's frame. Reason why the image is smaller is because I'm trying to add more of a "target area" for the UIButton. However, the image is being…
Raphael Caixeta
  • 7,808
  • 9
  • 51
  • 76
52
votes
6 answers

How do I disable a UIButton?

I am working on a project in which I have to show all photos of Photo Library in a plist and show them horizontally on UIButtons. My app will also have an edit button: when the user clicks this button, a delete mark (such as usually appears in…
Rahul
  • 951
  • 3
  • 10
  • 16
52
votes
7 answers

set cornerRadius and setbackgroundimage to UIButton

I am trying to set cornerRadius of UIButton but I dont know how to do it. If I do like this: button.layer.cornerRadius = 5; works well, if I do like this : button.layer.cornerRadius = 5; [button setBackgroundColor:[UIColor…
user1570600