为 iPhone 应用程序创建自定义 UITabBar 真的很酷吗?

发布于 2024-10-11 03:15:11 字数 972 浏览 6 评论 0原文

我最近做了很多研究,了解如何在我的 iPhone 应用程序上获得不同的外观和漂亮的效果 UITabBar,但不幸的是我只找到了如何替换背景颜色等的内容。

好吧,我'我们已经检查过这个名为 Momento 的应用程序,它非常酷,并且提供了一个非常光滑的选项卡栏:

Momento's UITabBar

所以这里有几个元素我想要询问你们是否可以帮助我,为我提供有关如何获得类似效果的正确指示:)

  • 项目上方的箭头: 如您所见,此应用程序有一个运行的动画箭头位于所选项目上方,具有非常平滑的动画。

  • 项目图像的选定状态不是那种蓝色的默认状态,也不是以不同色调的棕色和灰色版本显示的默认状态。

  • 漂亮的项目分隔符,带有斜角垂直线。

  • tabBar不同的背景图像

  • tabBar不同的高度

此时经过一些研究,我可以通过子类化 UITabBarController 来设置高度和背景图像,但我仍然不确定如何完成其他项目,特别是与漂亮的箭头效果相关的第一个项目。

我该怎么做?请澄清通过子类化 UITabBarController 可以做什么或不能做什么,特别是是否可以在 Interface Builder 中完成。

I am doing a lot of researching lately about how to get a different looking with nice effects UITabBar on my iPhone app, but unfortunately I am only finding things on how to replace background color etc.

Well, I've checked out this app called Momento which is pretty cool and presents a very slick tabBar:

Momento's UITabBar

So there are a couple of elements here I would like to ask you guys if you could help me by giving me the right directions on how to get a similar effect :)

  • Arrow above items: as you can see this app has this animated arrow that runs above the selected item with a very smooth animation.

  • Selected Stated of the item's image is not that blue-ish default one neither the default state which displays in a different shade of brown and gray version.

  • nice Items separators with beveled vertical lines.

  • different background image for the tabBar

  • different height for the tabBar

At this point after some research I am able to set the height and background image by subclassing UITabBarController but I'm still not sure on how to accomplish the other items specially the first one related to the nice arrow effect.

How do I do this? Please clarify what can or can't be done by subclassing the UITabBarController and specially if can be done in Interface Builder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我不吻晚风 2024-10-18 03:15:11

github 上有一个名为 BCTabBarController 的项目,旨在模仿中使用的标签栏iPhone 版推特。它有一些您正在寻找的东西,并且应该提供一个很好的起点。

There's a project on github called BCTabBarController that aims to mimic the tab bar used in Twitter for iPhone. It's got some of the things you're looking for, and should give a great starting point.

旧故 2024-10-18 03:15:11

这两个都是很好的答案,但是两个库都有问题:BCTabBarController 不知道如何创建选项卡栏图标的“蓝色”突出显示版本; iDevRecipies 不会将事件发送到子视图控制器,也不会在旋转时调整导航栏的大小。

请注意:自定义导航栏需要大量的试错调试(正如我所发现的)。

Both of these are good answers, but both libraries have problems: BCTabBarController doesn't know how to create the "blue" highlighted version of a tab bar icon; and iDevRecipies doesn't send events to child viewcontrollers nor resize the navigation bar on rotate.

Be warned: custom nav bars are a lot of trial-and-error debugging (as I have found).

混浊又暗下来 2024-10-18 03:15:11

只需使用具有 TabBar 宽度和高度的 UIView。在视图上添加自定义背景图像和自定义按钮。将视图的文件所有者设置为 AppDelegate。现在您可以简单地将 IBActions 与按钮连接起来。自定义视图可以放置在选项卡栏上通过 addSubView 到 TabBar 控制器的视图中。您可以通过在按钮操作中使用 tableviewcontroller 的 setSelectedIndex 方法在视图控制器之间进行切换。

Simply use a UIView with TabBar width and height.Add custom background image and custom buttons on the view.Set the fileowner of the view as AppDelegate.Now you can simply connect the IBActions with the buttons.The Custom view can be placed over the tabbar by addSubView to the TabBar controller's view.You can switch between viewcontrollers by using the setSelectedIndex method of tableviewcontroller in the button action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文