すべてのタッチイベントをUIKeyboardでキャプチャしようとしています。トップにUIWindowを追加 UIView/UIWindow内の特定のタッチイベントを次のレスポンダに渡します(sendEvent:/ hitTest:は機能しません)
、働いていたこれらのどれにイベントを渡す:
- HitTestを:私が試してみました。
UIKeyboardをサブクラス化することはできないようです。
どのような方法で効果がありますか?
おかげで、
ピーク
アップデート:私は(ちょうど設定のような次のレスポンダに特有のタッチイベントを渡すのUIViewまたはUIWindowを追加することができます方法:
は、問題を単純化することができますuserInteractionEnabled NOへの)?
HERESに私のコード(もちろん動作しません...):
- (void)sendEvent:(UIEvent *)event { NSLog(@"%@",event); //if ([self eventIsNoteworthy:event]) [self extraEventHandling:event]; [super sendEvent:event]; // Apple says you must always call this! } -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { CGPoint hitPoint = [underneathButton convertPoint:point fromView:self]; if ([underneathButton pointInside:hitPoint withEvent:event]) return underneathButton; NSLog(@"Called"); return [super hitTest:point withEvent:event]; //return mainWindow; } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"Start"); [self.nextResponder touchesBegan:touches withEvent:event]; }
タッチイベントを言うとき、特定のキーが押されたシーケンスを意味しますか? – blake305
@ blake305いいえ、私はタッチされた位置のCGPointsを意味します。 – PeakJi
自分のキーボードを作成して提示し、textFieldに押された文字を渡し、CGPointをNSLogに渡したいと思っていますか? – AMayes