1

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

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

提前感谢您的帮助,尼科

4

1 回答 1

2

他们使用了自定义底部栏,而不是 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];
于 2009-09-16T03:26:15.300 回答