简体   繁体   中英

How to get the targetRect from the [UIMenuController sharedMenuController] object

I need to get the targetRect of the [UIMenuController sharedMenuController]. I already try this:

[UIMenuController sharedMenuController] addObserver:self forKeyPath:@"targetRect" :NSKeyValueObservingOptionNew context:NULL];

Are you trying to get this for a UITextView or UIWebView? If it is UITextView, this answer might help you.

How can I get the selected text frame from a UITextView

You can't get the actual targetRect since it is declared private in UIMenuController.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM