如何在 UINavigationBar 中使用 UITextView 导航到下一个 UIViewController [英] How to navigate to next UIViewController using UITextView in an UINavigationBar

查看:29
本文介绍了如何在 UINavigationBar 中使用 UITextView 导航到下一个 UIViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 UITextView 作为按钮,在单击 UITextView 后,它应该弹出到另一个 UIViewController(不是根控制器,下一个).

I'm trying to use an UITextView as a button, and after clicking on the UITextView it should pop to to another UIViewController (not the root one, next one).

使用 UIButton 工作正常(通过拖动到下一个 UIViewController 并选择Push"作为 segue 类型,无需进行任何编码).但是,用 UITextView 做同样的事情是行不通的!

Using an UIButton works fine (by dragging to next UIViewController and choosing "Push" as the segue type, without doing any coding). But, doing the same thing with a UITextView does not work!

那么,我的问题是如何使用 UITextField 导航到下一个视图控制器?

So, my question is how to navigate to the next view controller using an UITextField?

推荐答案

尝试将 UITapGestureRecognizer 添加到文本视图并使用该回调来触发 segue.

Try adding a UITapGestureRecognizer to the text view and using that callback to trigger a segue.

我认为没有代码你无法做到这一点.

I don't think you can do this without code.

这篇关于如何在 UINavigationBar 中使用 UITextView 导航到下一个 UIViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆