【发布时间】:2019-04-07 15:26:11
【问题描述】:
到目前为止,基本上我得到的是一个带有自定义图标的基本 TabBarController。现在我想尽可能简单地在 TabBar 的顶部添加带有特定 UIColor 的边框。我怎么做? My tabBar so far
【问题讨论】:
标签: swift xcode uitabbarcontroller tabbar
到目前为止,基本上我得到的是一个带有自定义图标的基本 TabBarController。现在我想尽可能简单地在 TabBar 的顶部添加带有特定 UIColor 的边框。我怎么做? My tabBar so far
【问题讨论】:
标签: swift xcode uitabbarcontroller tabbar
配置标签栏如下:-
// Create a new layer which is the width of the device and with a heigh
// of 0.5px.
CALayer *topBorder = [CALayer layer];
topBorder.frame = CGRectMake(0.0f, 0.0f, self.view.frame.size.width, 0.5f);
// Set the background colour of the new layer to the colour you wish to
// use for the border.
topBorder.backgroundColor = [[UIColor blueColor] CGColor];
// Add the later to the tab bar's existing layer
[self.tabBar.layer addSublayer:topBorder];
self.tabBar.clipsToBounds = YES;
要么将你的标签栏子类化并将其写在那里,要么将其写为全局函数。
【讨论】: