Objective-C: Background image and title in Navigation Bar

前端 未结 2 1207
小鲜肉
小鲜肉 2021-01-24 22:22

In need a background image AND a title in my Navigation Bar. For the image I write a category:

@implementation UINavigationBar(MyNavigationBar)
- (void)setBackgr         


        
2条回答
  •  悲哀的现实
    2021-01-24 22:57

    I got it!

    @implementation UINavigationBar(MyNavigationBar)
    - (void)drawRect:(CGRect)rect {
        UIImage *image = [UIImage imageNamed: @"navBarBackgrd.png"];
        [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    }
    @end
    

    See Background image for navigation view

提交回复
热议问题