如何更改分隔导航栏和视图的线条颜色? 例如,flickr将其更改为灰色( http://www.geardiary.com/wp-content/uploads/2009/09/Screen-shot-2009-09-08-at-8.00.06-AM.png

默认情况下,我总是黑...

先谢谢你的帮助, 尼科

有帮助吗?

解决方案

他们使用自定义底栏而不是Apple提供的底栏。我不知道你的设置,但如果你可以制作或绘制自己想要的自定义视图(你可以这样做),并在其上粘贴按钮(你也可以这样做),那么你有一个工具栏

#define TOOLBAR_HEIGHT 44

CGRect frame = CGRectMake(self.view.bounds.size.height - TOOLBAR_HEIGHT, 0.0, self.view.bounds.size.width, TOOLBAR_HEIGHT);
UIView *customBottomBar = [[UIView alloc] initWithFrame:frame];
[customBottomBar setBackgroundColor: [UIColor grayColor]];

UIButton *button = [[UIButton alloc] initWithFrame:<frame goes here>]
... <button setup>
[customBottomBar addSubview:button];
[button release];

...<more buttons>
...<more buttons>

[self.view addSubview:customBottomBar];
[customBottomBar release];

要回答你的问题,你可以添加你想要的任何视图,所以虽然我建议的方式是最可定制的,你可能只想在正确的位置放置一个1像素高的彩色条(在顶部执行此操作的现有工具栏:

CGRect frame = CGRectMake(self.view.bounds.size.height - TOOLBAR_HEIGHT, 0.0, self.view.bounds.size.width, 1);
UIView *customLine = [[UIView alloc] initWithFrame:frame];
[customLine setBackgroundColor: [UIColor grayColor]];
[self.view addSubview:customLine];
[customLine release];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top