我怎样才能制作中央凸起的标签栏项目?
首先我想说我是 iPhone 应用程序开发的新手。当我选择选项卡栏的一项时,我想制作一个选项卡项,那么它应该看起来像
提前非常感谢。
At first I want to say that i am new in iPhone application development.I want to make a tabbaritem when i will select a item of the tabbar then it should be look like that
Many Thanks In Advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
知道它已经得到回答,但想提供另一种方法。
根据文档,子类化 UITabBarController 是一个坏主意。当我实际尝试使用 UIImagePickerController 作为子类化选项卡栏后面的视图控制器之一时,我也遇到了无穷无尽的麻烦。
我采用了一种更简单的方法,只需在选项卡栏项目上覆盖一个 uibutton 即可。示例项目可以在这里找到:
https://github.com/group6/RaishedCenterButton
但这只是一个示例。您仍然需要完成将其合并到应用程序中的工作。
Know it's already been answered, but wanted to offer an alternative approach.
Subclassing UITabBarController is a bad idea, according to the docs. I also had no end of trouble when I actually tried to use a UIImagePickerController as one of the view controllers behind the subclassed tabbar.
I took a much simpler approach just overlaying a uibutton over the tabbar item. Example project can be found here:
https://github.com/group6/RaisedCenterButton
It's just an example though. You're still going to need to do the work to incorporate it into an app.
这已经在很多教程中进行了介绍。这些应用程序中的大多数实现这种效果的方式是在中间的选项卡栏顶部放置一个自定义的 UIButton,该按钮的样式与选项卡栏类似。
iDev Recipes 有一个很好的教程和代码示例
This has been covered in quite a few tutorials. How most of these apps achieve the effect is they put a custom UIButton which follows similar styling to the Tab Bar on top of the tab bar in the center.
iDev Recipes has an excellent tutorial with the code example
为此,您需要通过子类
UITabBarController
创建自定义选项卡栏。TabBarController.h 文件:
.m 文件
希望它能给您带来想法。
For this you need to create custom tab bar by Sub classing
UITabBarController
.TabBarController.h file :
.m file
Hope it gives you idea..
我建议不要这样做。 iOS 用户习惯了熟悉的标签栏功能。突出显示足以让他们知道他们在哪个选项卡上。
你的设计理念非常有吸引力,但这是有代价的。拉起的条形项目旁边的条形上方的区域被浪费了,或者必须减小其他图标的大小。这将使它更难以使用,而不是更容易。
这里有一个很好的建议:从忙碌的生活中抽出 2 个小时阅读 Apple iOS 人机界面指南从头到尾。本书引人入胜,将为您提供解决此类设计问题的良好指导。
I would advise not to do this. iOS users are used to the familiar tab bar functionality. The highlight is sufficient to let them know on which tab they are.
Your design idea is very attractive, but it comes at a cost. The area above the bar beside the rased bar item is wasted, or the size of other icons have to be reduced. This will make it more difficult to use, not easier.
Here is a good tip: take 2 hours out of your busy life and read the Apple Human Interface Guidelines for iOS from cover to cover. Its fascinating reading and will give you good guidance for design questions like this.