iOS 导航栏
我想构建一个在视图之间具有这种导航的应用程序: 带有文本项的滚动视图(如菜单栏)。在应用程序商店(免费)上查看加拿大广播电台应用程序。
如何进行?我知道我需要一个滚动视图,但在那之后...你必须明白我对 iOS 5 没有太多经验。
查看此快照作为示例:
I want to build an application with this kind of navigation between views:
a scrollview with text items (like a menu bar). Check Radio-Canada app on app store (free).
How to proceed? I know that I need a scrollview, but after that... You have to understand that I don't have too much experience with iOS 5.
Check this snapshot for an example:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于水平滚动视图,只需创建一个滚动视图并向其添加按钮即可。可以通过加载白色椭圆形并使用 resizeableImageWithCapInsets: 扩展它以适合文本来创建您剪切的白色“选定”背景。将按钮的
click
事件链接到呈现新视图的函数。如果此“菜单栏”的作用类似于标准 iOS 选项卡栏,则您需要自己管理视图层次结构。对于垂直滚动视图,您很可能正在查看
UINavigationController
中包含的UITableView
,其中实现UITableViewDelegate
的类表视图的 code> 通过将新视图推送到导航控制器来响应didSelectRowAtIndexPath
。这是实现看起来像滚动项目列表的一种常见模式,其中点击一个单元格会导致转换到新屏幕。For a horizontal scrollview, just create a scrollview and add buttons to it. The white 'selected' background you clipped can be created by loading a white oval and using
resizeableImageWithCapInsets:
to extend it to fit the text. Link the button'sclick
event to a function that presents the new view. If this 'menu bar' acts like a standard iOS tab bar, you'll need to manage the view hierarchy yourself.For a vertical scrollview, most likely you're looking at a
UITableView
contained within aUINavigationController
, where the class implementingUITableViewDelegate
for the table view is responding todidSelectRowAtIndexPath
by pushing a new view onto the navigation controller. This is a common pattern to implement what looks like a scrolling list of items, where tapping on one cell causes a transition to a new screen.