ios - ActionSheet not working iPad -


I am using ActionSheet in my application. This works on my iPhone, but it is not on the iPad simulator.

This is my code:

IBAction function dialog (this: AnyObject) {go optionMenu = UIAlertController (title: zero: message: "Choose option", preferredStyle: (:, "delete" style: title .DEFAULT, handler: {(warning: UIAlertAction) - & gt; println ("Filtre deleted") .ActionSheet) go deleteAction = UIAlertAction) cancel cancelAction = UIAlertAction (title: "cancel", style: .cancel, handler: {(warning: UIAlertAction) -> zero in the println ("paused")} optionMenu. AddAction (deleteAc Tion) optionMenu.addAction (cancelAction) self.presentViewController (optionMenu, animated: true, perfection: zero)}

and my error:

exception exception Due to 'nsgenic expiation' the app is terminated, the reason: 'Your application has been presented UIAlertController (style style) UIAlertControllerStyleActionSheet UIAlertController Model Presentation Style UIModalPresentationPopover with this style. You must provide location information for this popover via the popup presentation controller of the Warning Controller. You must either provide Source Weave and Source Rect or a Barton item. If this information is not known when you submit the information controller, you can make it available in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation. After presenting the Options menu since the UIPopoverPresentationController on the iPad, you will receive a source from the following:

postprop = "Text">

The scene or button must be provided, because it tells you in your error, this means that your action sheet indicates the button where the user was started from where it was started.

For example, if you are presenting your options menu by tapping on the right navigation bar item. You can do something like this:

  optionMenu.popoverPresentationController .barButtonItem = self.navigationItem.rightBarButtonItem self.presentViewController (optionMenu, animated: true, completion: zero)?  

Or you can set a view like this:

 <(You just need one of these 2) Code> optionMenu.popoverPresentationController .sourceView = yourView self .presentViewController (optionMenu, animated: true, perfection: zero)  

Also keep in mind that if you change your ULTT Controller style to an alert rather than declare it, then you specify it Will not need to be I'm sure you should know this, but I want to help anyone coming to this page.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -