使用我自己的图像更改导航栏背景

R. *_*ewi 2 iphone background uinavigationbar uisplitviewcontroller

我想使用自己的图像更改导航栏背景,但我真的不知道该怎么做。我在谷歌上搜索它,但一些示例在导航栏模板中告诉我。我的应用程序是一个分割视图基础。我怎么能那样做?

iOS*_*ter 5

如果您想在不使用类别的情况下更改导航栏的背景,这可能会有助于营造这种感觉,看看它是否满足您的需求:

- (void)viewDidLoad {
    [super viewDidLoad];

        UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
        //here for v, width= navBar width and height=navBar height

    [v setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"a.png"]]];

    [self.view addSubview:v];

    [v release];

    [self.navigationController.navigationBar setBackgroundColor:[UIColor clearColor]];

    [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
}
Run Code Online (Sandbox Code Playgroud)