uialertcontroller

Swift writing a function that takes self as an input

廉价感情. 提交于 2019-12-02 09:58:00
I have alert that is being fired from different location so I decided to make a function to be called. func alertSCFlag(x: Int) { var alert = UIAlertController() switch x { case 1: alert = UIAlertController(title: "Not Finished", message: "sorry but you must give the project a title and description", preferredStyle: UIAlertControllerStyle.alert) default: alert = UIAlertController(title: "Not Finished", message: "sorry but you need to choose a type of project", preferredStyle: UIAlertControllerStyle.alert) } alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler:

How Add Image into UIAlertbox in Swift 3?

我只是一个虾纸丫 提交于 2019-12-02 08:10:10
I would like to add Image in UIAlertbox so I add the following codes. let alertController = UIAlertController(title: "Gender", message: "" , preferredStyle: .alert) // Create the actions let okAction = UIAlertAction(title: "Female", style: UIAlertActionStyle.default) { UIAlertAction in // exit(0) debugPrint("Press OK") } let cancelAction = UIAlertAction(title: "Male", style: UIAlertActionStyle.cancel) { UIAlertAction in } // Add the actions okAction.setValue(#imageLiteral(resourceName: "female_image"), forKey: "image") cancelAction.setValue(#imageLiteral(resourceName: "male_image"), forKey:

VoiceOver Z gesture won't trigger when UIAlertController is active

99封情书 提交于 2019-12-02 08:03:50
I'm trying to use the Z gesture to dismiss a UIAlertController. I have a very simple app. It has a single view with 1 button. Tapping the button presents an alert. I have implemented - (BOOL)accessibilityPerformEscape { NSLog(@"Z gesture"); return YES; } With VoiceOver on, scrubbing the screen prints out "Z gesture," but when I press the button and the alert is visible, scrubbing the screen does nothing, the method is not called and nothing is printed. What do I have to do to get this to function while the alert is on screen? Thanks... To get the desired result on your alert view thanks to the

How to scroll through actions in alert controller? Xcode 8, Swift 3, IOS

蹲街弑〆低调 提交于 2019-12-02 07:07:17
问题 Please help! :) Im a huge noobie here. I've gathered this code from various sources so i don't really know what I'm doing. My alert controller displays a textfield that I can write in, a 'cancel' action, an 'ok' action, and it also displays multiple 'input keyword to label' actions. It has so many actions (around 20 keyword actions that i need) that it either doesn't fit in the screen, it is covered by the keyboard, or it is in the way of the keyboard. It looks ugly and some of the buttons

UIAlertController: addSubview

泄露秘密 提交于 2019-12-02 03:32:54
问题 I want to add a subview to my alertcontroller. But why do the buttons go on the top ? How do I fix the problem? let alert = UIAlertController(title: nil, message: nil, preferredStyle: UIAlertControllerStyle.alert) let somethingAction = UIAlertAction(title: "Something", style: .default, handler: {(alert: UIAlertAction!) in print("something")}) let cancelAction = UIAlertAction(title: "Annuler", style: .cancel, handler: {(alert: UIAlertAction!) in print("cancel")}) alert.addAction

Perform segue after UIAlertController is dismissed

孤人 提交于 2019-12-02 01:52:39
问题 I've had similar problems in the past with UIAlertController in the sense that there's always a lag on the UI thread after the UIAlertController is dismissed. My problem right now is that I want to perform a segue if the user clicks on the "Okay" UIAlertAction and nothing happens if "Cancel" UIAlertAction is pressed. This is my code: // create the uialertcontroller to display let alert = UIAlertController(title: "Do you need help?", message: "Would you like to look for a consultant?",

How to present UIAlertController from SKScene

半世苍凉 提交于 2019-12-02 01:01:54
I'm working in Spritekit and I'm trying to present a UIAlertController from my SKScene, but I am having trouble doing it. I've watched several tutorials but none of the UIAlertController tutorials have been specific to Spritekit. I keep seeing this code below, but it has not been effective since SKScene is not a UIViewController. [self presentViewController:self animated:YES completion:nil]; I have the rest of the relative code below. Can anybody please help me present my UIAlerController on my SKScene. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"You Lose!" message

How to call my custom alert controller function to display in other view controller?

旧巷老猫 提交于 2019-12-01 23:58:46
问题 I have write my custom alert view controller.But,I am having error at calling my alert controller from other view controller.It show me the error that I described below. Error on console 2015-06-15 10:21:50.610 automobile[4197:62165] Warning: Attempt to present <UIAlertController: 0x7d11cf70> on <automobile.LoadingAlertViewController: 0x7bfa55d0> whose view is not in the window hierarchy! Here is my LoadingAlertViewController import UIKit class LoadingAlertViewController: UIAlertController {

Need help setting up an interface where rotation is fixed for most elements, but alert and sharing boxes auto-rotate with the device

折月煮酒 提交于 2019-12-01 23:53:32
I'm working with Xcode 7 and Swift 2. I am working on an interface with a camera preview layer and controls that display in a manner similar to the native iOS camera app. The controls all stay in place as you turn the device, but the icons "pivot" in place to orient properly for the device orientation. (I hope I explained that in a way that makes sense. If not, open the native camera app on your iPhone and turn the device around a few times to see what I'm talking about.) I have the basic interface working already by fixing the overall interface orientation using: override func

How to call my custom alert controller function to display in other view controller?

天涯浪子 提交于 2019-12-01 20:50:05
I have write my custom alert view controller.But,I am having error at calling my alert controller from other view controller.It show me the error that I described below. Error on console 2015-06-15 10:21:50.610 automobile[4197:62165] Warning: Attempt to present <UIAlertController: 0x7d11cf70> on <automobile.LoadingAlertViewController: 0x7bfa55d0> whose view is not in the window hierarchy! Here is my LoadingAlertViewController import UIKit class LoadingAlertViewController: UIAlertController { var loadingAlertController : UIAlertController! override func viewDidLoad() { super.viewDidLoad() }