- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
if (touch.tapCount == 1)
{
[UIView animateWithDuration:0.3 animations:^{
UIImage *image=[UIImage imageNamed:@"view1.png"];
imageView.image=image;
[self.view addSubview:imageView];
} completion:nil];
}
else if(touch.tapCount == 2)
{
[UIView animateWithDuration:0.3 animations:^{
UIImage *image=[UIImage imageNamed:@"view2.png"];
imageView.image=image;
[self.view addSubview:imageView];
} completion:nil];
}
}
これは私の方法ですが、欲しいです。 ダブルクリックすると2番目のビューが表示され、タップジェスチャーも使用されますが、同じです。このようなシーンを作成する方法:画面をタッチすると、firstViewが表示され、画面をもう一度タッチすると、画面にiosの2番目のビューが表示されます。
私の回答のヘルプ? –
はい、それは本当に働いて、ありがとう!しかし、私は多くの見方を示している場合、より簡単な方法がありますか? – WPEvergreen
One after One? –