UIAlertController 中的复选框和 objective c 中的操作表
Checkbox in UIAlertController with actionsheet in objective c
我想在 UIAlertAction 的一个选项中添加复选框,即 uibutton 和 uilabel
并且只有 UIAlertController 中另一个 UIAlertAction 中的按钮。
请帮助和建议如何实现它。
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 显示为弹出窗口
- 将 UITable 添加到 ViewController
- 在 UITable 中显示项目
- 通过添加自定义单元格自定义 UITable
- 在每个自定义单元格中添加一个按钮
- 该按钮将有两种图像,一种是空白框,另一种是带有复选标记的框
- 当用户触摸 table 单元格时,您需要更改与该 table 行对应的按钮图像,以便用户认为他们正在选中或取消选中该框
- 最后在底部添加一个完成按钮以关闭 viewcontroller
Google 所有这些项目都是教程。正如我所说,这不是一项简单的任务,因为 Xcode 中没有开箱即用的复选标记功能。
发件人:
我想在 UIAlertAction 的一个选项中添加复选框,即 uibutton 和 uilabel 并且只有 UIAlertController 中另一个 UIAlertAction 中的按钮。
请帮助和建议如何实现它。
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 显示为弹出窗口
- 将 UITable 添加到 ViewController
- 在 UITable 中显示项目
- 通过添加自定义单元格自定义 UITable
- 在每个自定义单元格中添加一个按钮
- 该按钮将有两种图像,一种是空白框,另一种是带有复选标记的框
- 当用户触摸 table 单元格时,您需要更改与该 table 行对应的按钮图像,以便用户认为他们正在选中或取消选中该框
- 最后在底部添加一个完成按钮以关闭 viewcontroller
Google 所有这些项目都是教程。正如我所说,这不是一项简单的任务,因为 Xcode 中没有开箱即用的复选标记功能。
发件人: