我想創造一些這樣的事:顯示按鈕的框架點擊導航控制器的動作uiitembar後
當在navigationcontorller(操作按鈕)右鍵框架客戶端點擊出現按鈕(如圖像)和客戶端選擇它們。通過選擇哪一個新的操作將完成。
我是一個新的iPhone和monotouch。是iphone中預定義組件的框架。如果是,它的名字是什麼,以及我如何使用它。如果它不是預定義的組件,我如何在我的應用程序中創建這樣的框架?
我想創造一些這樣的事:顯示按鈕的框架點擊導航控制器的動作uiitembar後
當在navigationcontorller(操作按鈕)右鍵框架客戶端點擊出現按鈕(如圖像)和客戶端選擇它們。通過選擇哪一個新的操作將完成。
我是一個新的iPhone和monotouch。是iphone中預定義組件的框架。如果是,它的名字是什麼,以及我如何使用它。如果它不是預定義的組件,我如何在我的應用程序中創建這樣的框架?
這是一個UIActionSheet。有一個MonoTouch sample演示如何使用它。
這是UIActionSheet
。這裏是一個小例子:
var sheet = new UIActionSheet ("");
sheet.AddButton ("Send email");
sheet.AddButton ("Send message");
sheet.AddButton ("Cancel");
sheet.CancelButtonIndex = 2;
sheet.Clicked += delegate(object sender, UIButtonEventArgs e) {
if (e.ButtonIndex == 2)
return;
};
sheet.ShowInView (this);
感謝您的回覆。不幸的是,只能選擇一個答覆作爲答案。謝謝 – 2013-03-11 12:21:00
添加該代碼在ViewDidLoad
方法,
UIBarButtonItem *arrow = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(showActionSheet)] autorelease];
self.navigationItem.rightBarButtonItem = arrow;
寫showActionSheet方法的代碼,並添加UIActionSheet *actionSheet in .h
文件,並給@property和@synthesize。的UIActionSheet
#pragma mark - UIActionSheet Delegate Methods
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
// code for selected first Button.
}
else if(buttonIndex == 1)
{
// code for selected Second Button.
}
}
問題用Monotouch標記。 – petert 2013-03-11 12:14:52
@petert也用obj-C標記:/ – 2013-03-11 12:29:14
添加委託方法你可以用'UIActionSheet'這個...... – Venkat 2013-03-11 12:03:23