开发者

Do I have to subclass in this case?

开发者 https://www.devze.com 2023-03-05 10:52 出处:网络
I have a UIViewController and a UITextView in it. I want to get touchesbegan method in UIViewController, 开发者_运维技巧but of course, it\'s being blocked b the UITextView. So, do I have to subclass U

I have a UIViewController and a UITextView in it. I want to get touchesbegan method in UIViewController, 开发者_运维技巧but of course, it's being blocked b the UITextView. So, do I have to subclass UITextView to override resignsfirstresponder? There's got be antoher way, otherwise I am going to have to create two files just to override a method that simply returns NO.

Thanks.

Update: Basically I want to display a UIActionSheet whenever the user taps on the screen. But I also want the UITextView to be scrollable.


You could set your UITextView.userInteractionEnabled = NO (this can be done in interface builder/Xcode 4). Then touches will pass through to the view behind your UITextView. You could use a UIControl instead of a UIView for your view controller's view if you want to intercept touches to your view controller's view.

Can you tell us more about the interaction you're trying to create?

0

精彩评论

暂无评论...
验证码 换一张
取 消