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
2 answers

unrecognized selector sent to instance error when a button is clicked

I'm not entirely sure why I am getting this error. It occurs when I click the button on my FirstViewController: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FirstViewController 1ButtonPress:]: unrecognized…
user3728778
  • 117
  • 3
  • 8
3
votes
3 answers

How to make UIButton appear in last cell only?

I am fairly new to Objective C programming, and have a UITableView setup with a custom cell. I want to make it so a user can touch a button that will add another cell, and this button will appear in the last cell only. Currently, it is not showing…
J.J.
  • 1,128
  • 2
  • 23
  • 62
3
votes
2 answers

Programmatically change title color of UIButton whose title set as attributed in iOS 7

I have added one UIButton in my UITableView programmatically. My problem is i need to give the Letter Spacing as well as need to change the button title color. I have given the Letter Spacing in button title text using below code, but title text…
Anand Gautam
  • 2,541
  • 3
  • 34
  • 70
3
votes
4 answers

UIbutton title line spacing

I have builed a button with two titles line by this code: rootBntUI.titleLabel.font = [UIFont fontWithName:@"Avenir-Black" size:UserListFontSize]; [rootBntUI.layer setBorderWidth:0]; rootBntUI.titleLabel.textColor = [UIColor…
Viet Nguyen
  • 2,285
  • 2
  • 26
  • 43
3
votes
3 answers

How to put an image and a bottom text together in a UIButton?

I want to put an centered image and a bottom centered text in a UIButton. How I can do that? Thanks in advance.
reinaldoluckman
  • 6,317
  • 8
  • 42
  • 50
3
votes
1 answer

Interface builder UIButton custom background image not working on simulator/device

I'm trying to do something really simple. I have an image for a button and I'm trying to set it on a custom button in interface builder. I set the background image accordingly (no case sensitivity problem here). In interface builder it shows up, but…
xenonii
  • 158
  • 1
  • 8
3
votes
2 answers

Weirdest occurrence ever, UIButton @selector detecting right button, doing wrong 'else_if'?

So I dynamically create 3 UIButtons (for now), with this loop: NSMutableArray *sites = [[NSMutableArray alloc] init]; NSString *one = @"Constution Center"; NSString *two = @"Franklin Court"; NSString *three = @"Presidents House"; …
Scott
  • 4,066
  • 10
  • 38
  • 54
3
votes
2 answers

MKAnnotationView custom button image

I am trying to use a custom image on my MKAnnotationView when I use the following code I get no image on my annotation. I have checked in debug to ensure the image is being properly loaded into the UIImage. - (MKAnnotationView *)mapView:(MKMapView…
Clip
  • 3,018
  • 8
  • 42
  • 77
3
votes
0 answers

Change Tint Color of Text on UIButton Using UIViewTintAdjustmentMode

I'm trying to find a way to change the tint color of the text on my custom UIButton by using UIViewTintAdjustmentMode. I have regular UIViews, for example, where I have their initial "tintColor" property set to a specific value, and then if I change…
jac300
  • 5,182
  • 14
  • 54
  • 89
3
votes
1 answer

UIButton image does not show in Navigation Bar

I am trying to a slide menu. The only problem is that the image for the UIButton does not show at runtime. This is the code I have written. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the…
user2167323
  • 159
  • 1
  • 2
  • 8
3
votes
2 answers

UIButton setBackgroundImage consumes a lot of memory

I'm using the following code: UIImage *buttonImage; if (p.placeImage != nil) { buttonImage = [UIImage imageWithData:p.placeImage]; } else { buttonImage = [UIImage imageNamed:@"bg_place_noimg.png"]; } [imageButton…
arielcamus
  • 773
  • 1
  • 8
  • 24
3
votes
2 answers

iPhone: adding button to scrollview makes button inaccessible to interaction

For some reason, the button initialized in the addBook method of my viewController won't respond to touches. The selector I've assigned to it never triggers, nor does the UIControlStateHighlighted image ever appear when tapping on the image. Is…
clozach
  • 5,118
  • 5
  • 41
  • 54
3
votes
4 answers

UICollectionViewCell - how to select all items/cells in UIButton action method

I'm trying to select all UICollectionViewCells after a UIButton is tapped. How do I do this?
Sandeep Sachan
  • 373
  • 3
  • 15
3
votes
1 answer

Stop the UIButton being 'active' when finger is dragged outside its bounds

How can I make the area of a UIButton in which the button still triggers the touchUpInside method smaller? When I press a button and drag my finger outside it (not lifting the finger), the area outside the button's bounds that keeps the button…
neja
  • 378
  • 2
  • 8
3
votes
4 answers

How can I send the relevant UITextField text data to the function in a collapsable UITableView?

I have this collapsable UITableView where there is a UITextField and a UIButton in the last cell in each table section. I would like to send the text in the UITextField to the function that is called by the UIButton that is next to it in the same…
joshg47
  • 135
  • 1
  • 10
1 2 3
99
100