2012-12-04 67 views

回答

0

正如文档所述("imageView is the button’s image view. (read-only)"),它是只读属性,您不能更改imageView。您必须使用推荐的方法setImage:forState:。基本上UIButton可能会有不同的实现,而不是你期望的,myBtn.imageview.image可能实际上不会将所需的图像设置为按钮。 setImage:forState:可能具有与仅设置myBtn.imageview.image = newimg;完全不同的实现。通过在你的问题中直接设置,你可能会得到一些意想不到的结果,因为实际的实现不会被执行。

相关问题