私は4-5個のボタン(ボタンの代わりにuiviewを使うことができます)を隣り合わせに並べています。タッチiphoneを強制的にキャンセルする
ユーザーが1つのボタンから他のボタン(セルフビューの外側)にタッチすると、このタッチをキャンセルして次のボタン(表示)のタッチを開始します。
この機能を実現する方法は?
私は、ボタンの代わりにuiviewを使用して、隣り合わせに保ち、タッチイベントを処理しました。
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject]; //anyobject
CGPoint touchLocation = [touch locationInView:touch.view];
if(![self pointInside:touchLocation withEvent:nil])
{
//touch is outside of my current view , do something to cancel current touch and i can get touchesmoved for the next view . help me to write something.
}
}
私たちは、このようなUIを持っているときに、イベントを処理するための他の方法はあります。
ありがとうございました。
上記に加え、 。ユーザーが1つのキーから別のキーに指をスライドさせると、どのようにタッチイベントが発生しますか?どのようにこの動作を達成する。リンクやコードベースを教えてください。 – Niraj