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.

uibutton
Filter by
Sorted by
Tagged with
0 votes
1 answer
30 views

How to underline title with UIButton.Configuration?

This is my convenience init for UIButton: convenience init(underlinedTitle: String, font: UIFont, color: UIColor) { var configuration = UIButton.Configuration.plain() configuration.title = ...
Bartłomiej Semańczyk's user avatar
0 votes
0 answers
19 views

Vibration problem when rotating ImageView in UIButton - iOS

Comparison with the first function call I created a UIButton with text and images that fetched the calendar. And I'm rotating the imageView 90 degrees with the button action. However, as you can see ...
이경은's user avatar
0 votes
1 answer
31 views

Subview on UIButton always appears behind the label and image

I have a label which is supposed to be a badge for unread notifications count, but since refactoring to use UIButton.Configuration the label always gets rendered behind the button label and image, no ...
vajzs16's user avatar
  • 20
-1 votes
2 answers
27 views

How to apply a .symbolEffect (ie, the animation such as pulse) to an SF system image to a UIButton in UIKit?

Is it possible to apply a .symbolEffect (ie, the animation such as pulse) to an SF system image to a UIButton in UIKit, ie not a SwiftUI app or insert ? (Pls note that there are a 100 questions ...
Fattie's user avatar
  • 17.1k
0 votes
1 answer
37 views

Set Size for UIButton with new iOS15 Configuration Approach

My goal is to add button to the right hand side of a section header in a UITableView. However, when I made my new target iOS15, I found that I had to adopt UIButton configuration to set the padding to ...
Dave's user avatar
  • 12.1k
1 vote
1 answer
35 views

Use uibutton push to use a function and change a variable value

I have a problem I do not find a solution to (or maybe I just did not understand it elsewhere on the website...). Here is my problem: I use a GUI as a uifigure and uibutton inside. When the uibutton ...
Thib's user avatar
  • 11
0 votes
1 answer
39 views

Enhancing UIButton: Achieving a More Visible Press Effect

I've noticed that a default, standard, plain-style button doesn't provide a strong indication when it is pressed. For example, consider this plain-style button with its default settings. As you can ...
Cheok Yan Cheng's user avatar
-2 votes
1 answer
57 views

How do you change (by .configuration?) the tintColor, when the button is depressed, in a custom/filled UIButton?

Pls note that this question is about tintColor. This question has no relation to backgroundColor, which is totally different. Also, I notice there are many QA about the tintColor of an image on a ...
Fattie's user avatar
  • 17.1k
-1 votes
1 answer
79 views

Why can't a UIDeferredMenuElement be added to an array of UIAction, whereas you can form an array with one?

Say you have† var ele = // an [UIAction] So, yourButton.menu = UIMenu(children: ele) Every app needs to know when the menu opens, so you use the usual trick, let trick = UIDeferredMenuElement....
Fattie's user avatar
  • 17.1k
0 votes
1 answer
58 views

iOS how do I detect when a IUButton with showMenuAsPrimaryAction is beginning to present the menu?

I have a UIButton with the menu set to a UIMenu (with chidren) and ShowMenuAsPrimaryAction set to true. but I would like to know when the button is pressed and the menu is about to be presented so I ...
canderse's user avatar
  • 309
-2 votes
1 answer
76 views

UIButton reference from UIMenuElement

I have four UIButton's and each has an associated UIPopUpMenu. Each UIMenuElement has the same action and menu list across all four UIButtons's. My selector essentially does the same action, but ...
user14337541's user avatar
1 vote
2 answers
76 views

Align text in many UIButton, even though SF Symbols (or other images) have varying widths?

Have a few UIButtons (perhaps in a stack view), left align, and each with an image. When you set the content inset left (4 in the example), the minX of the text (the "S" in the example) ...
Fattie's user avatar
  • 17.1k
0 votes
1 answer
53 views

How to get tableview cell's textfield values in submit button in swift

I have added textfield in tableview cell and want all textfield values in submitButton code: how do i get added tableview text in submitButton class TableCell: UITableViewCell{ @IBOutlet weak var ...
Swift's user avatar
  • 1,160
2 votes
1 answer
152 views

With an iOS 17 "popup type" UIButton, how to set the selected item in code?

Say you have a popup-type button, @IBOutlet var popupButton: UIButton! let xx = ["Horse","Dog","Cat","Budgie"] let opts = xx.map({ fn in return UIAction(...
Fattie's user avatar
  • 17.1k
0 votes
1 answer
202 views

Unreal engine execute event if ANY button on UI widget is pushed/clicked. [Blueprint] [SOLVED]

I've found stack overflow to be more useful then the unreal engine community, I'm having an issue with a blueprint where I'm creating buttons based on the data in an array.[] so that I can achieve an ...
Shadow Edwards's user avatar
-1 votes
1 answer
30 views

UIButton setImage has no (immediate) effect

Consider the following built in assertion: button.isSelected = true button.setImage(nil, for: .selected) assert(button.image(for: .selected) === nil) //^^^^^^^^^^^^^^ this trips with === and == Why? ...
Anton Tropashko's user avatar
0 votes
1 answer
106 views

How to "fix" a button on a specific position in SwiftUI

I have a TV remote image asset complete with buttons where I lay invisible buttons on top of it to make it functional. The problem is, since the invisible buttons need to be over their respective ...
Mark's user avatar
  • 1
1 vote
1 answer
29 views

Programmatically changing the properties of a VC's navigation bar button in response to a button press in another VC

I've created a navigation bar button in MainViewController using override func viewDidLoad() { super.viewDidLoad() navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Save&...
vonbecker's user avatar
0 votes
1 answer
70 views

Mac Catalyst UIButton Configuration Issues?

I currently have my application set to run on iPad & Mac (Mac Catalyst), with my interface option set to Optimize for Mac, and am having serious difficulty updating the button padding when running ...
Will Von Ullrich's user avatar
-1 votes
1 answer
116 views

How to remake UIButton to use UIButton.Configuration

In the context of updating legacy code to modern standards, I have encountered a scenario where I need to refactor a UIButton creation and configuration process. The original implementation is as ...
Ajvar1's user avatar
  • 117
0 votes
0 answers
30 views

UIButton visible but cannot be pressed

My buttons can’t be pressed. When I press them there is no animation or highlight, and the onPressed method never gets called either. I strongly suspect there’s something wrong with the way I’m adding ...
BBedit's user avatar
  • 7,547
0 votes
2 answers
49 views

UIButton function will not respond when called in a UITableView cell

I have a UITableView and I have also defined a subclass of it to include a button in each of my cells. In order to check that its functionality works properly I have defined an @objc function (since I ...
willd's user avatar
  • 155
0 votes
1 answer
51 views

Fixed by myself: Change color of button when pressed

I have a ChoiceTextView.swift-file that contains the look of the button var body: some View { Text(choiceText) .font(.title) .foregroundColor(.white) ....
Poshin's user avatar
  • 1
1 vote
1 answer
86 views

Can I set a Fixed Order for a UIMenu?

I have a UIMenu in my app that I am populating in a specific order. I want the menu to always appear in the order that I populated it in. However, the automatic behavior of UIMenu displays the menu ...
zach2161's user avatar
  • 125
0 votes
1 answer
36 views

My UIButtons inside a scroll view aren't triggering their target function for some reason

I've been coding with Xcode for about two years now and I've run into an issue regarding a series of UIButtons programmatically initialized in my custom scroll view. For whatever reason, when tapped, ...
joshuascode's user avatar
0 votes
1 answer
76 views

Ensure consistent button height when UIButton.Configuration.showsActivityIndicator is true and false

With the following code, the button height is 28.33 while using the default large dynamic type size. When you tap the button to enable showsActivityIndicator the height unexpectedly increases to 34.33....
Jordan H's user avatar
  • 54.1k
0 votes
0 answers
30 views

tvos: change focused color of UIButton

How to change default white color of tvos swift UIButton focus selection? override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) { if let ...
ashish's user avatar
  • 11
0 votes
1 answer
33 views

Call a timer function only when a UIButton is clicked

I have a function that I want to run every time an interval is called but I only want to execute once my UIButton is clicked. My problem is that since the moment I run my simulator, the function ...
willd's user avatar
  • 155
0 votes
1 answer
169 views

How to make UIButton.Configuration highlight appearance match that of system buttons

I'm modernizing my app and updating UIButtons to use UIButton.Configuration. I switched a system button to the default plain configuration style but was surprised to find the button highlight state is ...
Jordan H's user avatar
  • 54.1k
0 votes
0 answers
28 views

Adjust button width to fit any text in a collection view

So my problem is that I have a collection view where I list the product categories. I want to fit the text with different widths into the button. I played around with the constraints a bit and that's ...
Mostafa Hendawi's user avatar
0 votes
1 answer
62 views

UIButton will not work in UIKit programmatically

I have been building a drawing app programmatically in swift UIKit. I have been able to create UIButtons for each case that I have defined inside a Pencil enum. I can see each button appear for each ...
willd's user avatar
  • 155
0 votes
1 answer
67 views

Create a UIButton for each enum case in swift programmatically [closed]

I am trying to build a drawing app just for fun in swift UIKIt programmatically but now I just ran into a problem I am trying to create a palette of colors to swap UIColor properties, for that I have ...
willd's user avatar
  • 155
0 votes
0 answers
57 views

Event response priorities for gesture recognizers, UIControl, and UIButton

I have a parent view with a gesture recognizer added. The parent view contains a UIButton and a UIControl, with corresponding actions added respectively. The code is as follows class MyViewController: ...
Yasic's user avatar
  • 69
0 votes
0 answers
33 views

UIButton / Attributed Text - Varying line Spacing

I've got a component in a Swift 5 project inheriting from UIButton. The button has two sections of text: a heading (1 line) and a subheading (1+ lines). The two sections of text are formatted as a ...
Rufus's user avatar
  • 105
0 votes
3 answers
98 views

Why is my default button on Android Studio is not like default?

So i don't know what happen but my default button look like this, and i'm pretty sure default button on android studio is not like that. Anyone know how to get my button back to default? because right ...
Satya Aryaputra Wigiyanto's user avatar
0 votes
1 answer
573 views

How do I fix ImageEdgeInsets deprecated in iOS 15.0 when the padding needs to be different on each side? [duplicate]

So imageEdgeInsets has been depricated in iOS 15. Right now the code looks like this: class MyButton: UIButton { init(title: String) { super.init(frame: .zero) setTitle(...
Joakim Sjöstedt's user avatar
0 votes
2 answers
83 views

UIButton frame size doesn't update to support increased font size from settings

I have a basic UIButton with the following constraints: I have some basic trailing and top constraints and I have a >= width and height constraint set to 48 as I want 48 to be my minimum width and ...
Shawn Frank's user avatar
  • 4,783
0 votes
1 answer
34 views

Change title of array of UIButtons

i have an array of buttons and I try to change the name of the buttons but I don't know how to access to all buttons when the array randomPokemons get new data in the function didSet. I can change the ...
Marcial's user avatar
  • 17
0 votes
1 answer
25 views

Animation not working on touchesBegan button highlight

I'm trying to highlight buttons using a custom UIImageView layer on top of the buttons, invoking touchesBegan, but its not animating. It's working perfectly except I can't seem to get it to animate ...
PrateekS's user avatar
-1 votes
2 answers
53 views

How to use a string in a function name

I have these functions: private func chooseOfferButton1Tapped() { let vc = ChooseRdvVC() vc.offerCatched = arrayCatched![0] HapticsManager.shared.vibrate(for: .success) ...
JOHNY's user avatar
  • 41
2 votes
2 answers
3k views

How to have UIButton image using UIButton.Configuration adapt and resize dynamically to the button size

I would like to use UIButton.Configuration to create and configure UIKit buttons in the app. I cannot have the image in the button resizing accordingly to the size of the button itself leading to an ...
psykocouac's user avatar
1 vote
0 answers
75 views

UIButton greys out when another View Controller is presented modally

I have a few buttons in a View Controller. One of them performs a segue to another View Controller. When this happens, all buttons change tint color to grey. When VC is dismissed, everything comes ...
vlad_skazka's user avatar
0 votes
1 answer
38 views

Updating Button Title w/ Boolean Variable Swift

I'm trying to figure out how to properly configure a follow/unfollow button in a similar fashion to Instagram. First I've created an IBOutlet for the button and used didSet to define its properties: @...
Vandal's user avatar
  • 770
1 vote
0 answers
291 views

How to add shadow on buttons with new UIButton Configuration way?

I am trying to refactor buttons in the app. Previously, shadows on buttons could be implemented easily using layer.shadowColor and similar properties. However, with the new Configuration style, I am ...
Martin Smith's user avatar
0 votes
0 answers
210 views

How can I avoid the titleEdgeInsets' was deprecated warning / Swift

I'm trying to make the warning 'titleEdgeInsets' was deprecated in iOS 15.0: This property is ignored when using UIButtonConfiguration disappear. At first, I used InfosButton.titleEdgeInsets.top = ...
user avatar
0 votes
1 answer
272 views

How to change position of image of UIButton in Swift

I'm trying to bring up the image of my UIButton of a few pixels, does anyone knows how to do it? I tried with ContentEdgeInset but it doesn't seem to work.
user avatar
0 votes
3 answers
80 views

Is there a way to save 'selected' state of a UIButton?

I'm creating a jigsaw puzzle app for kids with 24 different little puzzles in 24 different scenes. I've put the background music in a Singleton, like so: class MusicHelper { static let sharedHelper = ...
KrisP's user avatar
  • 56
1 vote
1 answer
166 views

How to get attribute from AttributeContainer in UIKit and assign it to some variable

I create next subclass: import UIKit class Button: UIButton { override func updateConfiguration() { var config = configuration ?? UIButton.Configuration.plain() let color = ...
Petr Bones's user avatar
0 votes
1 answer
141 views

SWIFT & Storyboard - Tableview with Sections and each them contains a list of checkboxes

Goodmornig, i need a little help for showing the tableview with sections and custom tableviewcell for each section. I would want achieve this goal as image below: From picture we understand there ...
Cristian Capannini's user avatar
0 votes
2 answers
65 views

UIButton and TextEdit inside of UIView inside of UIScroll View

I've got a UIButton and a couple of TextEdit's in a UIView. UIView itself is in a UIScrollView. Somehow UIButton can not be pressed in the structure I mentioned. Look at the following code: ...
Philipp's user avatar
  • 333

1
2 3 4 5
226