@interface XXViewController : XXNavigationController <UIAlertViewDelegate> {}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:_ContractCallNum message:nil delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:NSLocalizedString(@"Button 1", nil), NSLocalizedString(@"Button 2", nil), nil];
[alert show];
[alert release];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"alertView is %d", buttonIndex);
switch (buttonIndex) {
case 0:
// Cancle
break;
case 1:
{
// Button 1
}
break;
case 2:
{
// Button 2
}
break;
default:
break;
}
}
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel",nil)
destructiveButtonTitle:nil
otherButtonTitles:NSLocalizedString(@"Button 1",nil),
NSLocalizedString(@"Button 2",nil), nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex)
{
case 0:
{
// Button 1
} break;
case 1:
{
// Button 2
}
break;
default:
break;
}