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 created in UItableview cell crashes when tapped

I created a custom UItableviewcell added a button into its initWithStyle area: favoriteButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; favoriteButton.backgroundColor = [UIColor clearColor]; [favoriteButton…
theprojectabot
  • 1,163
  • 12
  • 19
3
votes
1 answer

Making UIButton content fully tappable with clear background color

I have a set of UIButtons where each label is just a number. On each button of them, I set the background color to clear, there is no UIImage set. The problem is those buttons are only tappable on their label which makes it hard to tap. I checked…
Nico
  • 6,269
  • 9
  • 45
  • 85
3
votes
1 answer

UIButton in tvOS: focused state interferes with text

Since there's no UISwitch in tvOS, I'm using a UIButton to implement a simple On/Off toggle. I've set the button title text for UIControlStateNormal and UIControlStateSelected to indicate the button's on/off state, but the new UIControlStateFocused…
Echelon
  • 7,306
  • 1
  • 36
  • 34
3
votes
3 answers

How to do automated UI testing for system button on XCode7?

My Storyboard has only one UI, and it has navigation bar with one UIBarButtonItem with System Item: Add. It also has another info UIButton. When doing UI testing in English everything works good without any problem. But if you switch the language…
clu
  • 165
  • 3
  • 10
3
votes
1 answer

Adding UIButtons for specific words in UITextView

Imagine an app like Wikipedia for the Apple TV, where it has a block of text that contains information about a given topic. Some words or phrases in the text could be other available topics you could read. Therefore you need to make those…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
3
votes
1 answer

Position of my UIButton are varying for in all simulator

I am under one project.In that I created one uibutton at bottom of my viewcontroller using code (Not via storyboard).But when i run my app,my uibutton are placing in differents positions.for example in iphone 5,6 simulator are in some position.In…
2131
  • 93
  • 1
  • 10
3
votes
0 answers

Swipe Animations in iOS

We need similar kind of functionality in iOS, can anyone help me the easiest path or any sample source codes. I have attached the image for reference.
Raj
  • 69
  • 6
3
votes
1 answer

Swift 2.0, UILabel and setTranslatesAutoresizingMaskIntoConstraints

I have upgraded my xcode and now using Swift 2.0. I have an issue with all components which I set at runtime and used to rely on setTranslatesAutoresizingMaskIntoConstraints It seems that the method is no longer available and I had to comment out…
zevij
  • 2,416
  • 1
  • 23
  • 32
3
votes
2 answers

UIButton auto-adjust Button font size Swift

I try to make out some quiz and have a problem with my answer buttons. Simple fact: The text is too long and I try to auto-adjust it for cells using different methods. My current status: for btn in btnArr{ …
patreu22
  • 2,988
  • 4
  • 22
  • 31
3
votes
3 answers

Change size of UIButton programmatically with Swift

I know this question has been asked before but I can't seem to make any of the solutions work. I have my buttons set up with AutoLayout, but in order to get them to fit on an iPhone 4 I need to make them shorter. I have this, which I've tried in…
thumbtackthief
  • 6,093
  • 10
  • 41
  • 87
3
votes
3 answers

PrepareForSegue from a UIButton in a custom prototype cell

As the title say I have a tableView with prototype cell; cell is a custom cell (so I made a class called CustomCell.swift in witch I created the IBOutlet for image, label, button etc); here my class import UIKit class CustomCell: UITableViewCell { …
Fabio Cenni
  • 841
  • 3
  • 16
  • 30
3
votes
1 answer

Add 2 lines of attributed string to title of UIButton not working

I have a UIButton. I'm trying to get the buttons title to have 2 lines, and the second line should be smaller than the first. Here's my code: var myMutable = NSMutableAttributedString(string: "someText\n\(someString)", attributes:…
Jessica
  • 9,379
  • 14
  • 65
  • 136
3
votes
2 answers

Why don't my buttons go?

I'm setting up two buttons inside UITableViewCells. The cell itself shouldn't ever respond to selection, just my two buttons. Here's the code in question: -(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath…
Dan Ray
  • 21,623
  • 6
  • 63
  • 87
3
votes
1 answer

Popover segue from UICollectionView ReusableView (header)

I added a UIButton to a UICollectionView header. I like to instigate a popover segue from the button to a UITableViewController. I control-drag from the button on the collection view header to the tableView Controller and choose present as popover…
3
votes
1 answer

Custom UIButton cant interact with linked UIImageView

I'm stuck on the following code. Some how my UIButton Extended class cant show or hide an UIImageView My methods are being called and the imageview is not nil. Here is the code: @interface UILinkedImageButton : UIButton { IBOutlet UIImageView…
rckoenes
  • 69,092
  • 8
  • 134
  • 166