iphone - UIActionSheet 按钮显示 View

标签 iphone ios uiview uiactionsheet

我正在尝试使用以下代码使我的 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/

相关文章:

ios - map 注释在应该聚类时重叠

ios - 绘制一个真正的1像素线,iOS7

swift - public init中的问号是什么意思?(coder aDecoder : NSCoder)?

iphone - 从 UITableView Cell 下载内容

javascript - Meteor:谷歌登录无法在 iPhone/iPad 上使用

objective-c - objective-c 中的UITextField shouldChangeCharactersInRange方法

ios - 将 id 转换为更具体的类型或按原样使用 id 对象?

iphone - 如何使用 iPhone SDK 将 TimeStyle AM/PM 设置为小写

iphone - 在 iOS 上,如何检测我调用的号码是否占线?

ios - 当 View 位于 View 层次结构的顶部时,以编程方式使用自动布局在屏幕上居中 UIView