Questions tagged [uialertaction]

UIAlertAction object represents an action that can be taken when tapping a button in an alert. You use this class to configure information about a single action, including the title to display in the button, any styling information, and a handler to execute when the user taps the button. After creating an alert action object, add it to a UIAlertController object before displaying the corresponding alert to the user. Available in iOS 8.0 and later in UIKit.

A UIAlertAction object represents an action that can be taken when tapping a button in an alert. You use this class to configure information about a single action, including the title to display in the button, any styling information, and a handler to execute when the user taps the button. After creating an alert action object, add it to a UIAlertController object before displaying the corresponding alert to the user. Available in iOS 8.0 and later in UIKit. UIAlertAction

191 questions
6
votes
1 answer

UIAlertController - Action not executed if alert dismissed the first time

In a project I'm working on, I had to write a UIAlert helper module that would display popups here and there in my iOS app. The popups are written as class functions that I can simply call anywhere in the code (the class is static and so are all the…
Skwiggs
  • 1,218
  • 1
  • 12
  • 30
5
votes
2 answers

Focus disappearing when opening a UIAlertController on tvOS 10 GM

I want to display a UIAlertController on top of a UIViewController with a UICollectionView inside. The collection view needs to focus on startup, so I overrode the preferredFocusableView variable as follows: override var preferredFocusedView:…
Nicola Giancecchi
  • 2,905
  • 2
  • 21
  • 38
5
votes
0 answers

Change the Font of UIAlertAction in Swift

Changing the font for the message and title of a UIAlertViewController object has already been answered here: How to change font size and color of UIAlertAction in UIAlertController. But I want to know how to change the font on the title of…
Sam Adams
  • 51
  • 2
5
votes
2 answers

How can I perform the handler of a UIAlertAction?

I'm trying to write a helper class to allow our app to support both UIAlertAction and UIAlertView. However, when writing the alertView:clickedButtonAtIndex: method for the UIAlertViewDelegate, I came across this issue: I see no way to execute the…
4
votes
2 answers

Is there an equivalent of openSettingsURLString in SwiftUI?

I want to create an alert that redirects the user to Settings App after they denied camera usage for the first time, but the only way that I've seen so far uses UIKit and let settingsAction = UIAlertAction(title: "Settings", style: .default,…
Alexis Wei
  • 45
  • 3
4
votes
2 answers

How to change one UIAlertAction text color in a UIAlertController

How do I change text color for one UIAlertAction in a UIAlertController and not all of the action buttons. Here is my code for UIAlertController: I want to change Delete UIAlertAction text color to red. //Alert to select more method func…
Loc Dai Le
  • 1,291
  • 2
  • 22
  • 58
4
votes
3 answers

Get the UIAlertController from UIAlertAction?

I want to call a function rather than use a closure with a UIAlertAction. Is it possible to get a reference to the UIAlertController that owns the UIAlertAction? alert = UIAlertController(title: "City", message: "Enter a city name", preferredStyle:…
Mitchell Hudson
  • 1,013
  • 2
  • 9
  • 19
4
votes
3 answers

Issue to inherit UIAlertAction in Swift

Here is my code: class CustomAlertAction: UIAlertAction { init(title : String) { super.init(title: title, style: UIAlertActionStyle.Default) { (action) -> Void in } } } But I got the following compiling error: Must call a…
Bagusflyer
  • 11,547
  • 16
  • 84
  • 167
3
votes
2 answers

How to change UIAlertAction font or show UIAlertActionStyle.cancel style ActionButton on second position?

I don't want to change UILabel.appearance as it will apply to all labels. How I can show UIAlertController that will look like below image? Need to show bold button in the second position. By default, when I am setting UIAlertActionStyle.cancel it…
KMSOFT
  • 57
  • 1
  • 9
3
votes
0 answers

How to set the AttributedText to UIAlertAction in Swift?

How to display an option with UIAlertAction when it has Html tags in the text(ex: SpO2)? For a label we use attributed text. How can we set attributed text to UIAlertAction.
3
votes
2 answers

How to set up UIAlert to display a lot of information?

I want to set up a UIAlert as a "check" for a user. The user will be going to save a set of information, but I would like to give the user a chance to review the information after hitting the "save" button. Essentially, they hit "save", and then I…
Runeaway3
  • 1,403
  • 14
  • 37
3
votes
3 answers

How should you handle closure arguments for UIAlertAction

I have been trying to create a UIAlertAtion which also has a handler. I read the answers from this question and know how to do it. My question is only about the closure portion of it. 1) I know I can write : {alert in println("Foo")} Or {_ in…
Honey
  • 24,125
  • 14
  • 123
  • 212
3
votes
3 answers

The handler of a UIAlertAction is a bit too late - how can I make it immediate?

I am trying (...) to add a sound effect to the buttons added to a UIAlertController. I fire a sound effect in the handler, but this actually is a bit too late. The sound fires like 0.5 seconds too late. I want the sound to fire as soon as the alert…
Jonny
  • 14,972
  • 14
  • 101
  • 217
3
votes
1 answer

Get select index of UIAlertAction with dynamic items

I am building a dynamic list of actions. When pressing an action I would like to jump to a section in a table view. For this I would like to know the selected index of the action and replace it on the code section: "inSection: 0". Any way of doing…
bashan
  • 3,424
  • 6
  • 37
  • 57
3
votes
1 answer

How to Change the UIAlertAction button Color in iOS?

I've a UIAlertController and I've a bunch of UIAlertAcion Buttons. Now I need to show one button with other Color rather than the same color. For Ex Button1 Button2 Button3 Button1 and button3 should be in blue and button2 should be in red. Is…
SUDHAKAR RAYAPUDI
  • 459
  • 1
  • 7
  • 17
1
2
3
12 13