开发者

transparent view or button over a uitextview with touches passed to it

开发者 https://www.devze.com 2023-01-31 21:47 出处:网络
I have a uitextview and for some reasons I would it was not edita开发者_开发知识库ble but that it became editable when the user touches it. I thought to put on it another view or a button in a such wa

I have a uitextview and for some reasons I would it was not edita开发者_开发知识库ble but that it became editable when the user touches it. I thought to put on it another view or a button in a such way that this view or button intercepts the user touch and passes it to the uitextview.

Is it possible? How could I make a such transparent view or button?

Thanks,

Fran


ummm, did you mean, you want the UITextView to be not editable, but the view or button should catch the tap? why??

but yep you can,

just create a UIButton with [button backgroundColor:[UIColor clearColor]]; then catch the button tap and in that method call [textview becomeFirstResponder];

but if you are doing this roundabout thing just because for unknown reason, the UITextView is uneditable by tapping, try setting [textView setUserInteractionEnabled:YES];

or maybe some other views frame is covering the textview and is not letting the tap event through to the uitextview. try putting it on top of everything not below.

0

精彩评论

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