将checkbox列表添加到UIAlertController

我正在使用UIAlertController

现在我可以从下面的代码中列出一个项目:

{ UIAlertController *controller = [UIAlertController alertControllerWithTitle: @"Beds" message: @"" preferredStyle: UIAlertControllerStyleAlert]; [controller.view setBackgroundColor:[UIColor clearColor]]; [controller.view setTintColor:[UIColor blackColor]]; for (int a=0;a<[bedsCount count];a++) { UIAlertAction *button = [UIAlertAction actionWithTitle: [bedsCount objectAtIndex:a] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [bedSelectionText setTitle:[bedsCount objectAtIndex:a] forState:UIControlStateNormal]; }]; [controller addAction: button]; } 

我想在下面的链接显示的格式显示button单击UIAlertController上的列表:

View post on imgur.com

你在图中显示的东西很复杂,不能用一个简单的UIAlertController实现。

为了复制你的屏幕截图,你需要的是

  • 学习如何将ViewController显示为popup窗口
  • 将UITable添加到ViewController
  • 在UITable中显示项目
  • 通过添加自定义单元格来自定义UITable
  • 在每个自定义单元格中添加一个button
  • 该button将具有两种图像,一个空白框和另一个带有复选标记的框
  • 当用户触摸表格单元格时,您需要更改与该表格行相对应的button图像,以便用户认为他们正在检查或取消选中该框
  • 最后在底部添加完成button以closures视图控制器

谷歌所有这些项目的教程。 正如我所说,这不是一个简单的任务,因为在Xcode中没有开箱即用的复选标记function。