我正在尝试UINavigationBar
使用以下代码自定义项目:
CGSize size = [UIImage imageNamed:kGlobalNavigationBarButtonBackOrange].size;
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
[backButton setImage:[UIImage imageNamed:kGlobalNavigationBarButtonBackOrange] forState:UIControlStateNormal];
[backButton setImage:[UIImage imageNamed:kGlobalNavigationBarButtonBackPressedOrange] forState:UIControlStateHighlighted];
[backButton addTarget:self action:@selector(dismissViewController) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithCustomView:backButton];
UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Detail"];
[item setLeftBarButtonItem:barButton];
[item setTitleView:self.navigationItem.titleView];
[self.navigationBar pushNavigationItem:item animated:YES];
[self.navigationController pushViewController:vc animated:YES];
但是,当我运行它时,导航栏看起来并没有什么不同。