带有单选按钮的 UIAlertView iOS [关闭]

2023-12-19

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

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


我建议您使用模态视图或尝试添加子视图来实现此目的,不要使用 UIAlertView 来执行此操作。我也做了同样的事iOS 7 UIAlertView 中的 UIDatePicker 自定义 https://stackoverflow.com/questions/18894653/ios-7-uidatepicker-in-uialertview-customisation但从 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];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

带有单选按钮的 UIAlertView iOS [关闭] 的相关文章

随机推荐