UIWebViewインスタンスにカスタムポップアップメニューを追加しました。
- (void)viewDidLoad
{
UILongPressGestureRecognizer* gesture = [[[UILongPressGestureRecognizer alloc]
initWithTarget:self action:@selector(handleGesture::)] autorelease];
}
- (void)handleGesture
{
}
- (void)handleGesture:(UIGestureRecognizer*)gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
[gestureRecognizer.view becomeFirstResponder];
UIMenuController* mc = [UIMenuController sharedMenuController];
[mc setTargetRect: gestureRecognizer.view.frame inView: gestureRecognizer.view.superview];
[mc setMenuVisible: YES animated: YES];
}
そしてそれは動作します!textarea(CodeMirrorエディター)をWebページに集中させるまで。この場合、次の例外があります。
-[FirstViewController handleGesture::]: unrecognized selector sent to instance 0x20369c00
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FirstViewController handleGesture::]: unrecognized selector sent to instance 0x20369c00'
*** First throw call stack:
(0x3608c2a3 0x3439c97f 0x3608fe07 0x3608e531 0x35fe5f68 0x3747ad31 0x374423dd 0x3762f479 0x37366837 0x3736529b 0x360616cd 0x3605f9c1 0x3605fd17 0x35fd2ebd 0x35fd2d49 0x3650f2eb 0x373b1301 0x140bb 0x14060)
libc++abi.dylib: terminate called throwing an exception
(lldb)
文書化されていないバージョンのhandleGestureセレクターをエキゾチックなパラメーターで実装する必要があると思います。正しいですか?必要なパラメータの種類を見つける方法は?