UIActionSheet

popupQuery = [[UIActionSheet alloc] initWithTitle:@"清空全部最近通话"

delegate:self 

cancelButtonTitle:@"取消"

destructiveButtonTitle:@"清空最近通话" 

otherButtonTitles:nil,nil];

popupQuery.actionSheetStyle = UIActionSheetStyleDefault;

[popupQuery showInView: tableView];

[popupQuery release];



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

    if (buttonIndex != [actionSheet cancelButtonIndex]){


        if(actionSheet == popupQuery){

            if (buttonIndex == 0) {

                //clear myself history events

                [mHistoryService clearEvents:[[idoubs2AppDelegate sharedInstance] username]];

                //[mHistoryService deleteEvents: MediaType_AudioVideo];

                // will be notified by the history service

            }else if(buttonIndex == 1){}

        }else if(actionSheet == actionSheetnew){

            @synchronized(mEvents){

                if (event) {

                    if (buttonIndex == 0) {

                        [MyCallViewController makeAudioCallWithRemoteParty: event.remoteParty andSipStack: [[NgnEngine sharedInstance].sipService getSipStack]];

                    }

                    else if (buttonIndex == 1) {

                        [MyCallViewController makeAudioVideoCallWithRemoteParty: event.remoteParty andSipStack: [[NgnEngine sharedInstance].sipService getSipStack]];

                    }

                    else if (buttonIndex == 2) {

                        

                        //To do : add to contact list

                        AddContactViewController *addContactView = [[AddContactViewController alloc] initWithNibName: @"AddContactView" bundle:nil];

                        [self.navigationController pushViewController: addContactView  animated: TRUE];

                        [addContactView mobile_phoneTextField].text=event.remoteParty;

                    }

                }

            }

        }

    }


}



你可能感兴趣的:(UIActionSheet)