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
1 answer

UIButton setTitle:longerTitle forState: contracting title string

I am trying to set the title of a UIButton using [button setTitle:changedTitle forState:UIControlStateNormal] The title is changing correctly but internally this appears to animated by UIButton and when changing from a long title to a short title…
Dallas Johnson
  • 1,546
  • 10
  • 13
3
votes
3 answers

When changing the button image, the button size is changed. Why?

In IB, the button size and location have been set perfectly well using autoLayout. But when I try to change the button image using the following if (need_Update) { [_updateButton setImage:[UIImage imageNamed:@"ipad_012_01_update2.png"]…
Jenny Cheung
  • 301
  • 2
  • 5
  • 12
3
votes
3 answers

How to stop UIButton from highlighting/flash each time its title is reset?

I'm using a UIButton as a label to display some number in its title. Every time the function is called to reset the title of this button, it flashes. It does not affect the functionality but hurts user experience. I'm wondering if there is a way to…
3
votes
1 answer

Alternative option of UIButton addTarget:action:forControlEvents: method in IOS

I know that this question has been asked so many times but i want to pass a custom object as an argument on clicking a button. UIButton addTarget:action:forControlEvents: doesn't allow us to do that but it is important for me so I can do further on…
3
votes
2 answers

Display UIButton in UITableView , when Cell is selected

I Want to add a UIButton to my UITableViewCell.My cells expands in height when it is selected.. The button must only be displayed when didSelectRow is called in the expanded area ... I have 4 cells that I want to populate with different questions,…
BENQ
  • 93
  • 5
3
votes
1 answer

How can I add gravity to UIButton SWIFT

So I am trying to add gravity to 4 UIButtons but they are not falling, I added this code to the view did load, I don't why this isn't working well. Here is the code: //initialize the animator var animator = UIDynamicAnimator(referenceView:…
Pixele9
  • 422
  • 8
  • 25
3
votes
0 answers

need custom LibraryPicker with initial image on custom cameraOverlay UIImagePickerController iOS8

I'm wondering how I can add the default Library picker button that can be found on an iPhone's default Camera app(can also be accessed via dashboard). The button looks like this, though this is an app custom implementation: So I know that it can be…
Chisx
  • 1,976
  • 4
  • 25
  • 53
3
votes
6 answers

How to change UIButton label programmatically

When I first run my app, I retrieve a number from my server and display it for my UIButton label. Think of this as a notification number displayed on a red UIButton. When I remove a notification within the app, I want my UIButton label decrement by…
3
votes
3 answers

Changing image of UIButton via click - Swift

Im getting an error with this code.. What it should do: When user taps button, the image changes to checked, taps again, changes to Unchecked. Im getting the error: AnyObject doesnt have member names 'setImage ... @IBAction func tick(sender:…
James Dithon
  • 41
  • 2
  • 6
3
votes
3 answers

Accessing custom cell attributes outside of cellForRowAtIndexPath

I want some thing like image below. User can click on + or - button and the increased or decreased count is display in UILabel i.e 1 in the image below. I know how to implement custom table view cell .I know how to implement the selector too. but I…
Nischal Hada
  • 3,230
  • 3
  • 27
  • 57
3
votes
2 answers

Set custom attribute on button

How can i set custom attributes on an button that is programmatically created? I have this code to create an button: var btn = UIButton(frame: CGRectMake(CGFloat(7 + add), 565, 39, 55)) …
da1lbi3
  • 4,369
  • 6
  • 31
  • 65
3
votes
3 answers

Custom UIButton Class for Reuse

Been looking online for a while now and haven't gotten a straight answer on how this is done. In my app I need a "Next" button that will reside on many ViewControllers. I want this next button to be the same (bordered, same background color, same…
lr100
  • 648
  • 1
  • 9
  • 29
3
votes
1 answer

Draw attention to and foster discovery of actionable controls

In an attempt to defer to content, I chose not to use any (navigation or tool) bars. The app has a tinted UIButton which brings up an action sheet (where the user could share the content, and adjust preferences). What I've seen is that people don't…
user4151918
3
votes
2 answers

UIButton not highlighted on border

I create a UIButton programmatically using the following code: myButton = [UIButton new]; [myButton setImage:[UIImage imageNamed:@"myButtonNormal"] forState:UIControlStateNormal]; [myButton setBackgroundImage:[UIImage…
Banana
  • 4,010
  • 9
  • 33
  • 49
3
votes
2 answers

Jerk When reloading UITableView when User is in bottom of the UITableView

All, I am facing some simple issue like i have multiple sections where i am display relevant data for each section, When ever there is a change in some UIButton action in One row, the data in the section changed based on it. When i am in bottom of…
kiri
  • 1,977
  • 5
  • 27
  • 55