2017-08-30 26 views
0

我們如何在操作表中添加表視圖。我正在使用xamarin ios。我需要一張帶手風琴的表格視圖。我可以用手風琴做普通的表格視圖。我需要動作表內的表格視圖xamarin ios中的操作表中的表視圖

回答

0

您應該做的第一件事就是使用UIAlertController而不是UIActionSheet,這在iOS 8中已棄用。您將擁有更容易操作警報功能。

UIAlertControllerUIViewController繼承,讓您根據需要添加子視圖。

// Create a new UIAlertController 
var alertController = UIAlertController.Create("Alert Title", "Some text here", UIAlertControllerStyle.ActionSheet); 

// Add your custom view to the alert. Any UIView can be added. 
var yourTableView = new UITableView(); 
alertController.View.AddSubview(yourTableView) 

// Add Actions 
alertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, alert => Console.WriteLine ("Ok clicked"))); 
alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, alert => Console.WriteLine ("Cancel clicked"))); 

// Show the alert 
controller.PresentViewController(alertController, true, null); 

的這個動作Here's an example,雖然它在斯威夫特。