UIAlertController中的checkbox与目标c中的操作表

我想添加checkbox,即UIButton和Uilabel在UIAlertAction中的一个选项,只有在UIAlertController中的另一个UIAlertAction中的button。

请帮助和build议如何实现它。

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"My Alert" message:@"This is an action sheet." preferredStyle:UIAlertControllerStyleActionSheet]; // 1 UIAlertAction *firstAction = [UIAlertAction actionWithTitle:@"one" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { NSLog(@"You pressed button one"); }]; // 2 UIAlertAction *secondAction = [UIAlertAction actionWithTitle:@"two" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { NSLog(@"You pressed button two"); }]; // 3 [alert addAction:firstAction]; // 4 [alert addAction:secondAction]; // 5 

试试这个技巧:

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

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

从: https : //stackoverflow.com/a/31941282/3901620