我在UIViewController中添加GADBannerView,通过给它提供框架rect(0,self.frame.view.height,bannerWidth,bannerHeight),但是当我试图将它拉起来只显示一小部分时。但是当使用rect(0,self.frame.view.height-bannerHeight,bannerWidth,bannerHeight)时,当我通过bannerHeight将其提升为动画时,它可以正常工作。
答案 0 :(得分:0)
首先,打印到NSLog您的帧以确定问题。还尝试通过更改偏移来移动它:
UIView *bannerView = [UIView new]; // Here your banner view creation
CGFloat bannerHeight = bannerView.frame.size.height;
NSLog(@"bannerView frame before animation:%@", NSStringFromCGRect(bannerView.frame));
[UIView animateWithDuration:1.0 animations:^{
bannerView.frame = CGRectOffset(bannerView.frame, 0, -bannerHeight);
} completion:^(BOOL finished) {
NSLog(@"bannerView frame after animation:%@", NSStringFromCGRect(bannerView.frame));
}];
显示您的代码。