点击 UINavigationBar 标题即可更改
我想知道如何创建一个导航栏,用户可以在其中点击导航栏的标题,以便它将打开一个新的模式视图,类似于用户在链接多个帐户时创建推文时的 Twitter 应用程序。
I was wondering how I could create a Navigation Bar where the user could tap the title of the navigation bar, so that it will open a new modal view, similar to the Twitter application when the user is creating a Tweet when they have multiple accounts linked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将
UIView
的自定义子类作为导航栏的titleView
。最简单的方法是使其成为一个按钮(或UIView
上的UIButton
),并设置一个操作来根据需要呈现模式视图。您可以设置一个视图来响应触摸,但我真的看不出走这条路的好处。You can put a custom subclass of
UIView
as thetitleView
of the navigation bar. The easiest thing is to make this a button (or aUIButton
on aUIView
) and set up an action to present the modal view as you like. You could instead set a view to respond to touches, but I really don't see the advantage of going that route.