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

Tabbar buttons order changed after go to other view

I have 2 buttons in my tabbar, programmatically added. But the order changed after navigating to another placeholder within the view. When I open the app: When I go to the movies tab: The code: self.searchButton = [[UIBarButtonItem alloc]…
Ruben
  • 349
  • 1
  • 12
3
votes
1 answer

UIButton only background slightly transparent

Is it possible to make just the background semi transparent? If I change the alpha it changes the title and the boarder. I can change the titleLabel.alpha property but it won't go above the buttons Alpha, only below it. I know I can make a custom…
Rudiger
  • 6,749
  • 13
  • 51
  • 102
3
votes
5 answers

In Swift (tvOS) how do you change a UIButton's highlight and focus colors?

So I have some buttons that I've added to a view through the Interface Builder and rather than using the system buttons I made them custom. I'm trying to figure out how to change characteristics, such as the text color and background color during…
3
votes
3 answers

Cannot update UIButton.image after view loads

I am attempting something relatively simple. I have a UIButton that loads with an image: @IBOutlet var peer5Outlet: UIButton! override func viewDidLoad() { super.viewDidLoad() peer5Outlet.enabled = true var img = UIImage(named:…
3
votes
2 answers

UIButton background color overlaps text on highlight

After I set my UIButton's backgroundColor and textColor for state highlighted the following output is presented: The problem here is that the button's background overlaps the white text. How can I solve this? I also have lots of problem on tvOS…
Teodor Ciuraru
  • 3,417
  • 1
  • 32
  • 39
3
votes
2 answers

How to design UIButton Like UITabBarItem in iOS?

I have to place 6 buttons in the bottom of particular screens like UITabBar. I have placed UIButton with Image and Text but, am not able to move the image on top of the button with centre alignment and place the button text in below of the image…
Yuvaraj.M
  • 9,741
  • 16
  • 71
  • 100
3
votes
1 answer

Set UIButton text color programmatically

I want to change the button text color which is in my Table view Footer. Here is code which i am using but it isn't working override func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { let footerView =…
hellosheikh
  • 2,929
  • 8
  • 49
  • 115
3
votes
1 answer

EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) getting thihs error when change uibutton s titlelabel size changing

when i want to change uibuttons title size i am getting this error. unfortunately this is working for one button but when i am trying for more then one button its not working. here is my code which is working for one button override func…
Govind Rakholiya
  • 427
  • 6
  • 24
3
votes
2 answers

Xcode Change color theme based on target

I am developing an ipad app which will have two targets but color theme will be different for the targets e.g. in Target1 the selected button font color will be red and in Target2 the selected button font color will be green.I was wondering that is…
Desert Rose
  • 3,376
  • 1
  • 30
  • 36
3
votes
1 answer

Inserting a chevron into a button like Apple does?

I would like to find an efficient way to add chevrons to my buttons similar to how Apple does in iTunes. For example, in the image below, you can see a chevron after the text "See All" and "Terms and Conditions." Is there a unicode character that…
Senseful
  • 86,719
  • 67
  • 308
  • 465
3
votes
2 answers

Using UITapGestureRecognizer to show/hide menus

I'm trying to find a good way to make a tap show/hide my menus, in the same way as iBooks. I set up UITapGestureRecognizer to do this, but unfortunately it means then that none of the buttons on the screen work. I know I can…
jowie
  • 8,028
  • 8
  • 55
  • 94
3
votes
3 answers

Present AlertView from UICollectionViewCell

I have a button in my UICollectionViewCell.swift: I want, based on certain parameters for it to be able to present an alert. class CollectionViewCell: UICollectionViewCell { var collectionView: CollectionView! @IBAction func…
3
votes
3 answers

change tint color of button image on different states

Hi I have an issue I can't figure out. I have wrote an extension that helps me colorize transparant PNG's extension UIButton { func setImageColorForState(image: UIImage, color: UIColor, forState: UIControlState) { let temp =…
Reshad
  • 2,570
  • 8
  • 45
  • 86
3
votes
2 answers

iPad: IBAction for UIButton responds on iPhone device, not on iPad

I have taken over the development and maintenance of a production iOS application being used mostly on the iPhone but also on the iPad. We found a specific UIButton that will respond as expected on the iPhone (device & simulator) but does not…
JWD
  • 12,188
  • 3
  • 34
  • 32
3
votes
4 answers

UIButton doesn't work on a custom UITableViewCell (Swift)

I'm really sorry for my english and if I make something wrong, and this is my first question here. I have a custom UITableViewCell as a view in *.xib file. with an UIImage in it and a button on that UIImage. I connected this button with an outlet to…
Nikolay Pryahin
  • 377
  • 5
  • 19