Iphone 行动表中的行动表

Iphone 行动表中的行动表,iphone,xcode,uiactionsheet,Iphone,Xcode,Uiactionsheet,我不熟悉Objective C和iPhone开发。 请告诉我如何在行动表中添加行动表。 就像当我点击一个按钮时,一个动作表被打开,然后我点击第一个按钮,另一个动作表出现。 请注明完整的代码。 谢谢使用UIActionSheet委托方法: -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { // Add a

我不熟悉Objective C和iPhone开发。 请告诉我如何在行动表中添加行动表。 就像当我点击一个按钮时,一个动作表被打开,然后我点击第一个按钮,另一个动作表出现。 请注明完整的代码。
谢谢

使用
UIActionSheet
委托方法:

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    if (buttonIndex == 0) { // Add an action sheet for one of these buttons -> maybe here if you want...

     NSLog(@"You clicked the first button...");

     UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Another action sheet"
     delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:@"Destructive" 
     otherButtonTitles:@"Other Button 1", nil];

    popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;

    [popupQuery showInView:self.view];

    [popupQuery release];

    } 

    else {

        NSLog(@"Dismissing action sheet");

    }

}

您只需关闭第一个UIActionSheet,然后显示另一个UIActionSheet即可。换句话说,您不希望在另一个UIActionSheet中显示UIActionSheet——您希望在另一个UIActionSheet被撤销后显示UIActionSheet

要了解何时取消操作表,您应该实现该协议。例如:

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
// first action sheet is dismissed
// show a new action sheet here
}

操作表显示,但未选择按钮索引。行动仍将取代第一个行动表。