【问题标题】:get the UIButton's background image获取 UIButton 的背景图片
【发布时间】:2010-12-07 17:21:14
【问题描述】:

我需要你的建议:我想知道如何在 UIImageView 中设置 UIButton 的 backgroundImage 图像。

即如果我触摸按钮,按钮的背景图像应该设置在 UIImageView 上。

有可能吗?如果是那怎么办?

【问题讨论】:

  • 不是click 而是touch :)
  • 为什么这被否决了?我的赞成票降为0!这个问题非常有用——Apple 只打破了他们对这一类的命名约定,因此很难发现该属性甚至存在:(

标签: iphone objective-c uiview uiimageview uibutton


【解决方案1】:
UIImage *image = self.myButton.currentBackgroundImage;

Apple Documentation for UIButton

【讨论】:

  • button.currentBackgroundImage 的返回值为 nil。我使用了 UIImage *image = buttonObject。当前背景图像;如果我在任何地方错了,请提出建议。
猜你喜欢
  • 1970-01-01
  • 2014-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-23
  • 2020-08-12
  • 1970-01-01
相关资源
最近更新 更多