5

如何在 iOS 中创建一个带有单选按钮的自定义警报视图,就像在 android 中的这个一样(我想要的是在 iOS 中)。

在此处输入图像描述

我搜索了一段时间,找不到任何方法,所以我在这里问。

4

1 回答 1

6

我建议您使用模态视图或尝试添加子视图来实现这一点,不要使用 UIAlertView 来做到这一点。我在 UIAlertView 自定义中做了相同的 iOS 7 UIDatePicker,但它从 iOS 7 停止工作。

操作表示例代码:

 UIActionSheet *actionSheet = [[UIActionSheet alloc]
                                  initWithTitle:@"Select State"
                                  delegate:self
                                  cancelButtonTitle:@"Cancel"
                                  destructiveButtonTitle:nil
                                  otherButtonTitles:@"State 1",@"State 2",@"State 3",@"State 4",@"State 5",@"State 6", @"State 1",@"State 2",@"State 3",@"State 4",@"State 5",@"State 6",@"State 1",@"State 2",@"State 3",@"State 4",@"State 5",@"State 6", nil];

    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
    [actionSheet showInView:self.view];
于 2013-11-06T05:42:21.003 回答