使UITextView响应轻击事件。 (苹果手机) [英] Make UITextView react to tap event. (iphone)

查看:312
本文介绍了使UITextView响应轻击事件。 (苹果手机)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个可滚动文本视图(不可编辑),显示一些帮助信息等,当用户完成它所有他要做的是点击它,它将消失/隐藏,用户将回到主屏幕。



UITextview不响应点击事件(或我不知道如何使它对点击事件做出反应)。
任何想法如何实现这个?



我也尝试把它放在一个透明的按钮,所以我可以捕获水龙头,但我不能滚动文本视图,因为它似乎是在按钮。 p>

我是iphone新手,任何帮助... gr8



感谢

解决方案

如何在文字检视中新增点按手势辨识器?

  UITapGestureRecognizer * gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(textViewTapped :)]; 
[yourTextView addGestureRecognizer:gestureRecognizer];


I'm trying to implemet a scrollable Text view (not editable) that display some help information etc. and when the user is done with it all he has to do is tap it and it will disapear/hidden and the user will be back in the main screen.

The UITextview not reacting to tap event (or i'm not sure how to make it react to the tap event). Any idea how to implement this ?

I also tried to put it inside a transparent button so i can capture the tap but then i cannot scroll the text view as it seem to be behinde the button.

i'm new to iphone , any help... gr8

Thanks

解决方案

How about adding a tap gesture recognizer to the text view?

UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(textViewTapped:)];
[yourTextView addGestureRecognizer:gestureRecognizer];

这篇关于使UITextView响应轻击事件。 (苹果手机)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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