【问题标题】:UIActionSheet checkmarkUIActionSheet 复选标记
【发布时间】:2015-01-15 18:53:11
【问题描述】:

我需要在 UIActionSheet 中标记选定的按钮。

如何在 UIActionSheet 按钮中添加复选标记?

有没有特定于 UIActionSheet 的方法,没有标准的在按钮内添加图像。

【问题讨论】:

  • 无法使用 UIActionSheet 完成。寻找第 3 方替代品。

标签: ios select uiactionsheet checkmark


【解决方案1】:
otherButtonTitles:@"√ 1", @"  2", 

【讨论】:

    【解决方案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"];
    }];
    

    【讨论】:

    • Xcode 7.2.1 不会编译它,因为 UIAlertAction 没有方法 setImage:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多