我有一个我在此tutorial之后创建的iAd,并且出于某种原因,当iAd显示当时正在进行的任何动画停止时。换句话说,动画工作正常,直到iAd开始,并且一旦iAd发出任何动画,那一刻停止或者回到原始位置而不完成动画。
这是我对iAd的代码
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
_adBanner = [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height, 320, 50)];
_adBanner.delegate = self;
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!_bannerIsVisible)
{
if (_adBanner.superview == nil)
{
[self.view addSubview:_adBanner];
}
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);
[UIView commitAnimations];
_bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (_bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);
[UIView commitAnimations];
_bannerIsVisible = NO;
}
}
这是我的动画之一
- (IBAction)showHideBlackboard:(id)sender
{
[UIView animateWithDuration:0.6 delay: 0.0 options: UIViewAnimationOptionCurveEaseIn animations:^
{
self.controlsView.frame= CGRectMake(10, 10, 250, 250);
}completion:^(BOOL finished)
{
[UIView animateWithDuration:0.6 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^
{
self.drawingView.alpha = 1.0;
self.drawingView.frame= CGRectMake(10, 10, 350, 350);
}completion:nil ];
}];
}
知道为什么iAd干扰了UIView动画?
答案 0 :(得分:0)
我最近遇到了类似的问题。事实证明,避免选项
self.translatesAutoresizingMaskIntoConstraints = NO;
解决了这个问题。