2017-10-04 54 views

回答

0

ActionSheetUIAlertController

// Create a new Alert Controller 
       UIAlertController actionSheetAlert = UIAlertController.Create("Action Sheet", "Select an item from below", UIAlertControllerStyle.ActionSheet); 

       // Add Actions 
       actionSheetAlert.AddAction(UIAlertAction.Create("Item One",UIAlertActionStyle.Default, (action) => Console.WriteLine ("Item One pressed."))); 

       actionSheetAlert.AddAction(UIAlertAction.Create("Item Two",UIAlertActionStyle.Default, (action) => Console.WriteLine ("Item Two pressed."))); 

       actionSheetAlert.AddAction(UIAlertAction.Create("Item Three",UIAlertActionStyle.Default, (action) => Console.WriteLine ("Item Three pressed."))); 

       actionSheetAlert.AddAction(UIAlertAction.Create("Cancel",UIAlertActionStyle.Cancel, (action) => Console.WriteLine ("Cancel button pressed."))); 

       // Required for iPad - You must specify a source for the Action Sheet since it is 
       // displayed as a popover 
       UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController; 
       if (presentationPopover!=null) { 
        presentationPopover.SourceView = this.View; 
        presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up; 
       } 

       // Display the alert 
       this.PresentViewController(actionSheetAlert,true,null); 

更多信息:https://developer.xamarin.com/recipes/ios/standard_controls/alertcontroller/

+0

换句话说,这不是内置的? – GenericTeaCup

+0

它内置! – TonyMkenu

+0

创建对话框的可能性是内置的。但确切的项目“呼叫”,“发送信息”,...的确切对话需要手动完成。这是你内置的意思,我猜? – GenericTeaCup

相关问题