HI, 我想打电话到我左下方工具栏上的左侧栏按钮项目上的操作表。我该怎么做
答案 0 :(得分:1)
设置按钮以运行'按下按钮',然后使用代码..
- (void)myButtonPressed:(id)sender
{
UIActionSheet* action = [[UIActionSheet alloc]
initWithTitle:@"Menu"
delegate:self
cancelButtonTitle:@"Continue"
destructiveButtonTitle:@"Quit"
otherButtonTitles:@"Debug",nil ];
[action showInView:self.view];
[action release];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: (NSInteger)buttonIndex {
switch (buttonIndex) {
case 0: // continue
NSLog(@"Continue");
break;
case 1: // Quit
NSLog(@"Quit");
break;
case 2: // Debug
NSLog(@"Debug");
break;
}
}
在.h文件中
@interface ViewController : UIViewController <UIActionSheetDelegate>