简体   繁体   中英

How to show DisplayActionSheet in xamarin.ios native app

We want to show DisplayActionSheet on button click in our xamarin.ios native app but its throw compile time error as "DisplayActionSheet does not exist in current context". How to solve this issue.. please help

DisplayActionSheet is not native iOs and thats why you are getting the error. What you want to do is create a new UIAlertController, add actions and present it.

Simple example :

var alertController = UIAlertController.Create(null, "Title", UIAlertControllerStyle.ActionSheet);
alertController.AddAction(UIAlertAction.Create("Text", UIAlertActionStyle.Default, action => { /* handle your action */ }));
viewController.PresentViewController(alertController, true, null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM