开发者

UITextView and data detector types - how to find out that external modal view controller is opened / closed when the link is long tapped?

开发者 https://www.devze.com 2023-04-06 21:57 出处:网络
in my specific situation I have an email link in UITextView, so that when user long taps on this link, an Action Sheet provided by iOS is opened, where you can e.g. create new contact with this email

in my specific situation I have an email link in UITextView, so that when user long taps on this link, an Action Sheet provided by iOS is opened, where you can e.g. create new contact with this email address and so on. This action opens another开发者_StackOverflow中文版 external (provided by iOS) modal view controller similar to Contacts app, but it is opened within our application, on top of current view controller.

I'd like to know when my view controller is covered by this external modal view controller and when it becomes visible again, because I need it to control opening / hiding the keyboard (and do some more). Unfortunately I've found no events being fired in this situation, no delegate methods of UITextView, viewWill/DidAppear/Disappear is not called either. I've even tested using my own UIApplication subclass and overriding -(BOOL)openURL:(NSURL *)url method, but it is only called if URL is tapped (like: short tap on http link to open it in Safari, short tap on phone number to call etc.), so it is not called in my situation (creating new contact with email address).

So far I have no solution, I'd greatly appreciate any ideas.


Your view controller should be receiving viewWillDisappear: and viewDidDisappear: and their counterparts. If you receive this shortly after a tap in your text view then it is not unreasonable to assume the user has triggered a system modal view controller.

0

精彩评论

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

关注公众号