2017-10-04 69 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

相關問題