我怎样才能在iOS上创建一个自定义警报视图,其上有一个类似于Android的单选按钮(我想要的是在iOS中)。
我搜索了一会儿,找不到任何办法,所以我在这里问。
答案 0 :(得分:6)
我建议您使用模态视图或尝试添加子视图来实现此目的,不要使用UIAlertView来执行此操作。我做了同样的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];