我正在尝试使用以下代码使我的 UIActionSheet 中的按钮执行 View 更改。
-(void)displayActionSheet:(id)sender
{
actionSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:nil
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Devanagari", @"English", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet showInView:self.view ];
[actionSheet release];
}
我如何修改此代码以使梵文和英文按钮链接到它们自己的单独 View ?
最佳答案
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *title = [actionSheet buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Devanagari"]) {
//Code if Devanagari button is pressed
}
if([title isEqualToString:@"English"]) {
//Code if English button is pressed
}
}
关于iphone - UIActionSheet 按钮显示 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9641167/