I had the same problem when I applied the following methods to adjust the override of the image of the navigation bar specific to landscape orientation. To get rid of the clip error, I commented on a part of the CGContextClip code, as shown below:
@implementation UINavigationBar(CustomBackground)
+ (UIImage *) bgImagePortrait
{
static UIImage *image = nil;
if (image == nil) {
image = [[UIImage imageNamed:@"iPhoneHeader_portrait"] retain];
}
return image;
}
+ (UIImage *) bgImageLandscape
{
static UIImage *image = nil;
if (image == nil) {
image = [[UIImage imageNamed:@"iPhoneHeader_landscape"] retain];
}
return image;
}
- (void) drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
if ([self isMemberOfClass:[UINavigationBar class]] == NO) {
return;
}
UIImage *image = (self.frame.size.width > 320) ?
[UINavigationBar bgImageLandscape] : [UINavigationBar bgImagePortrait];
//CGContextClip(ctx); // Causes '<Error>: doClip: empty path.' error when changing views.
CGContextTranslateCTM(ctx, 0, image.size.height);
CGContextScaleCTM(ctx, 1.0, -1.0);
CGContextDrawImage(ctx, CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), image.CGImage);
}
@end
source
share