是的,我已经看到了另一个问题,他们没有任何帮助。 所以我想把iAD横幅移开我的视线。它位于iphone上,位于纵向视图的屏幕顶部。这是我的代码。我在哪里错了?
//Move the banner off the screen.
- (void)moveBannerViewOffScreen
{
if (self.bannerView.isHidden == NO)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
bannerView.frame = CGRectOffset(bannerView.frame, 0, bannerView.frame.size.height);
[UIView commitAnimations];
self.bannerView.hidden = YES;
}
}
//Move the banner on the screen.
- (void)moveBannerOnScreen
{
if (self.bannerView.isHidden ==YES)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
bannerView.frame = CGRectOffset(bannerView.frame, 0, -bannerView.frame.size.height);
[UIView commitAnimations];
self.bannerView.hidden = NO;
}
}
答案 0 :(得分:1)
最好你可以改变iphone的“moveBannerViewOffScreen”中的代码
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:bannerView cache:YES];
bannerView.frame = cgRectMake(0,-50,50,320);
[UIView commitAnimations];
在 “moveBannerViewOnScreen”
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:bannerView cache:YES];
bannerView.frame = cgRectMake(0,0,50,320);
[UIView commitAnimations];
答案 1 :(得分:0)
您不应该需要隐藏相关代码。此外,您的代码每次都会进一步向上或向下移动横幅视图,因为您会逐渐应用偏移量。最好每次手动设置框架:
//Offscreen frame
bannerView.frame = CGRectMake(0, -bannerView.frame.size.height, bannerView.frame.size.width, bannerView.frame.size.height);
//Onscreen frame
bannerView.frame = CGRectMake(0, 0, bannerView.frame.size.width, bannerView.frame.size.height);
答案 2 :(得分:0)
另一个简单的答案: [myBannerView1 setAlpha:0];