UIMenuController how to show selection
how can i implement the UIMenuController with a selection shown below? I have a UIScrollview with a PDF loaded in it in a UIView (CGPDF...). I get the MenuController working without a selection but dunno how I can get the selection on the screen. It does not matter for me what is selected for now. I just want to have the visual selection shown.
开发者_如何学编程Below is the code I use for the UIMenuController.
UITouch *touch = [touches anyObject];
CGPoint tapPoint = [touch locationInView:self];
NSLog(@"\nPosition of Touch\nHeight: %f\nWidth: %f", tapPoint.y, tapPoint.x);
CGRect drawRect = CGRectMake(tapPoint.x, tapPoint.y, 20, 20);
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setTargetRect:drawRect inView:self];
[menu setMenuVisible:YES animated:YES];
精彩评论