- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
UIImageView *circleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"face.png"]];
circleView.frame = CGRectMake(0, 0, 200, 200);
circleView.layer.cornerRadius = 100;
circleView.center = self.view.center;
[self.view addSubview:circleView];
circleView.transform = CGAffineTransformMakeScale(0, 0);
[UIView animateWithDuration:1 delay:0 usingSpringWithDamping:.5 initialSpringVelocity:1 options:0 animations:^{
circleView.transform = CGAffineTransformMakeScale(1, 1);
} completion:nil];
正如您所看到的,我在此動畫方法中創建了一個名爲circleView的視圖。然後,我創建了一個touchesBegan方法,並且我想在觸摸屏幕時再次運行動畫。我應該怎麼做?在Objective-C中,我該如何復活?
問題不明確,簡要你的問題? –
在** touchesBegan方法中添加動畫代碼** – Sujay
因此,我想要創建一個touchesBegan方法,並且當觸摸屏幕時,它會再次進行動畫處理,而不是添加新的子視圖和動畫。 – Troller