开发者

Problem with setting background of UINavBar background

I am using the following code to set the background of the UINavBar

self.navigationController.navigationBar.layer.contents=(id)[UIImage imageNamed:@"topbar-nonretina.png"].CGImage;

However, sometimes I am getting the following error :

property `contents` not found on object of type `CALayer`

Can anyone kindly tel开发者_运维知识库l me whats happening here ? Thanks.


Probably cause you're not including QuartzCore in some file.

#include <QuartzCore/QuartzCore.h>

CALayer is defined there, so if you don't include that file, the compiler doesn't know that the layer property of navigationBar has a contents property itself

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜