我有一个 UITextView
,里面有很多文本,并按照我需要的方式进行了自定义。我在想,有没有办法让它可以点击,然后导航到一个新的 UIViewController
?
我正在寻找这个,似乎唯一的办法就是用一个不可见的 UIButton
覆盖它?
最佳答案
您可以将 UITapGestureRecogniser 添加到 TextView 中。在界面生成器中或在您的代码中。
UITapGestureRecogniser *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myfunction:)]:
[mytextview addGestureRecogniser:tap];
[mytextview setEditable:NO];
[mytextview setUserInteractionEnabled:YES];
[tap release];
编辑:感谢 Nekto
关于ios - UITextView 可点击,几乎像 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12683107/