私はいくつかの UILabels、UIImageView、ADBannerView を含む ViewController を持っています。関連する 2 つの動きがあります。UIImageView は、ユーザーがデバイスを持っている角度に基づいて回転し、ADBannerView は、表示する iAD があるかどうかに基づいてビューにスライドします。
UIImageView が静止している場合、ADBannerView はビューに正しくスライドします。ただし、UIImageView が回転し始めると、ADBannerView は消えます。私の知る限り、2 つのビューは完全に独立しています。
- (void) updateFloatingBar
{
double angleToUpright = [self calculateAngleToUpright];
double newAngle = angleToUpright - self.currentAngle;
[self.FloatingBarImageView setTransform:CGAffineTransformMakeRotation(newAngle*(CGFloat)(M_PI/180))];
}
- (void) hideAd
{
NSLog(@"Ad Hidden");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.adBannerView cache:YES];
self.adBannerView.frame = CGRectMake(0,self.view.bounds.size.height + 50,50,320);
[UIView commitAnimations];
}
- (void) showAd
{
NSLog(@"Ad Shown");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.compassADBannerView cache:YES];
self.compassADBannerView.frame = CGRectMake(0,self.view.bounds.size.height - 50,50,320);
[UIView commitAnimations];
}
繰り返しますが、最初の方法は正しく機能しますが、showAd によって配置された adBannerView を画面外に押し出すという二次的な効果もあります。