【发布时间】:2015-01-15 18:53:11
【问题描述】:
我需要在 UIActionSheet 中标记选定的按钮。
如何在 UIActionSheet 按钮中添加复选标记?
有没有特定于 UIActionSheet 的方法,没有标准的在按钮内添加图像。
【问题讨论】:
-
无法使用 UIActionSheet 完成。寻找第 3 方替代品。
标签: ios select uiactionsheet checkmark
我需要在 UIActionSheet 中标记选定的按钮。
如何在 UIActionSheet 按钮中添加复选标记?
有没有特定于 UIActionSheet 的方法,没有标准的在按钮内添加图像。
【问题讨论】:
标签: ios select uiactionsheet checkmark
otherButtonTitles:@"√ 1", @" 2",
【讨论】:
从 iOS 8.0 开始,您可以使用UIAlertController。在UIAlertController 中,每个按钮项都被称为UIAlertAction,它们会相应地添加。 UIAlertAction 包含一个名为 image 的运行时属性,您可以根据需要进行设置。
UIAlertActioin *action1 = [UIAlertAction actionWithTitle:@"1" style: UIAlertActionStyleDefault handler:(void (^)(UIAlertAction *action)) {
[action setValue:[UIImage imageNamed:@"your-image-name"] forKey:@"_image"];
}];
【讨论】:
UIAlertAction 没有方法 setImage: