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
精彩评论