【问题标题】:UIImage renderingMode coloured icon -> grey scale on UIAlertViewUIImage renderingMode 彩色图标-> UIAlertView 上的灰度
【发布时间】:2014-03-20 00:48:15
【问题描述】:

我在UIBarButtonItem 中有一张多色图像。当我显示UIAlertViewUIActionSheet 时,我想把它变成黑白。

我玩过不同的UIImageRenderingModes,但它们都不适合我。我可以让它变成灰度的唯一方法是,如果整个图像将 UIWindow tintColor 作为蒙版,这是我不想要的。我想保留所有颜色,然后在出现UIAlertViewUIActionSheet 时转换为灰度。

我在 WhatsApp 中看到了这一点,导航栏中的联系人图像是彩色的,当您点击查看 UIActionSheet 时,它会变成灰度。

谢谢!

【问题讨论】:

  • 您在寻找那个:stackoverflow.com/a/10033772/3319153 吗?希望对您有所帮助
  • 将其转换为灰度并不是一个问题,更多的是关于如何在出现 UIActionSheet 或 UIAlertView 时将其更改。
  • 您可以与他们的代表一起工作:– willPresentAlertView:– willPresentActionSheet:
  • 啊,当然。谢谢!请在下面发布您的答案,我会接受!

标签: ios ios7 uiimage uibarbuttonitem


【解决方案1】:

写 self.window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal; 在 AppDelegate 中的 didFinishLaunchingWithOptions 中。

【讨论】:

  • 这对我有用,只是我必须在 uiimageview 上设置它
【解决方案2】:

用于渲染黑白:

https://stackoverflow.com/a/10033772/3319153

要处理 ActionSheet 或 UIAlertView 事件,您可以使用他们的委托:– willPresentAlertView:– willPresentActionSheet:

【讨论】:

  • 非常感谢,正是我需要的。
猜你喜欢
  • 2017-08-19
  • 2021-10-06
  • 2015-11-20
  • 2013-07-28
  • 1970-01-01
  • 2011-12-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多