Check if UIView is activated

I have two animations; show search bar and show banner. Both of these animations resize the same view, and if they work at the same time (what they are), the last animation cancels the resizing. Is there anyway to check if the UIView animates the animation, and then the reserve for the animation?

I am sure that I am not using CAAnimations since Cocoa does not detect such a class.

This function runs when an ad is received. Unfortunately, this is the same time as ShowSearch.

- (void)adViewDidReceiveAd:(GADBannerView *)bannerView { if (!hasloaded) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration: 1.0]; [bannerView_ setFrame:CGRectMake(0, self.view.frame.size.height, bannerView_.frame.size.width, bannerView_.frame.size.height)]; // move and grow [bannerView_ setFrame:CGRectMake(0, self.view.frame.size.height-50, bannerView_.frame.size.width, bannerView_.frame.size.height)]; // set original position [UIT setFrame:CGRectMake(UIT.frame.origin.x, UIT.frame.origin.y, UIT.frame.size.width, UIT.frame.size.height)]; // move and grow [UIT setFrame:CGRectMake(UIT.frame.origin.x, UIT.frame.origin.y, UIT.frame.size.width, UIT.frame.size.height-50)]; [UIView commitAnimations]; hasloaded = true; } } 
+4
source share
2 answers

You can use the completion block in the UIView +animateWithDuration:animations:completion: method (which is a more modern alternative to beginAnimations / commitAnimations ) to link multiple animations (I assume this is what you want to do?).

+2
source

If you select your code while entering it and press control + K , you will save the formatting and make it beautiful. Give it a try. Reading a wall of text made from code insertion into an environment with non-color formatting in true type.

Nick Weaver says:

UIView has a layer (CALayer). You can send animations to it that will give you an array of keys that identify the animations attached to the layer. I believe that if there are any entries, the animation is running. If you want to dig even deeper, look at the CAMediaTiming protocol, which uses CALayer. It does some additional information about the current animation.

0
source

Source: https://habr.com/ru/post/1400832/


All Articles