Invalid context when creating UIImageView

吃可爱长大的小学妹 提交于 2019-12-03 02:40:43

I had this problem until I found out that my cap inset argument to resizableImageWithCapInsets: was wrong — it didn't leave any un-capped area at all (you need at least 1x1 pixel not covered by a cap). So make sure that:

(insets.left + insets.right) < width

and

(insets.top + insets.bottom) < height

The Simulator is case-insensitive. The device is case-sensitive. The png is named correctly? Maybe it is 'Login' with a capital L.

I still can't comment due to low rep. However I'd like to add to neon1's answer which helped me a lot.

You also need to make sure that all of the insets are greater than zero.

insets.left > 0

insets.top > 0

insets.right > 0

insets.bottom > 0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!