我创建了一个UINavigationBar
比苹果默认导航栏高一点的自定义。
我似乎找不到将UIBarButtonItem
向下移动到两条虚线之间直接居中的方法。
是否有捷径可寻?我试过创建一个自定义按钮,但没有成功。理想情况下,我只想将默认的后退按钮向下移动几个像素。
用于创建UINavigationBar
自定义标题图像的代码和UIBarButtonItem
:
//Create image for navigation background
UIImage *NavigationPortraitBackground = [[UIImage imageNamed:@"navbackground.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UINavigationBar appearance] setBackgroundImage: NavigationPortraitBackground
forBarMetrics:UIBarMetricsDefault];
//Centered title image
UIImageView *headerImage = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"hometitle.png"]];
[headerImage setFrame: CGRectMake(0, 0, 180, 49)];
self.navigationItem.titleView = headerImage;
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] init];
[backBarButtonItem setTintColor: [UIColor colorWithRed:0 green:69.0/255 blue:118.0/255 alpha:1]];
[backBarButtonItem setStyle: UIBarButtonItemStylePlain];
self.navigationItem.backBarButtonItem = backBarButtonItem;
[backBarButtonItem release];
提前致谢,