必须以不同的方式解决它。无论如何,谢谢你的帮助!
答案 0 :(得分:1)
我通过在单独的视图上放置动态控件和表来解决这个问题。我有不同的导航栏高度+ iAd横幅出现和消失。
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
if (!self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectMake(0, 0, 320, 50);
self.tableView.frame = CGRectMake(0, 50, 320, self.view.frame.size.height - 50);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectMake(0, 0, 320, 0);
self.tableView.frame = CGRectMake(0, 0, 320, self.view.frame.size.height);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
答案 1 :(得分:0)
如果您将UITableView动态添加到UIView,请尝试设置autoresizingMask:
tableView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);
然后将tableView添加为subView:
[view addSubView:tableView];
希望这会有所帮助
答案 2 :(得分:0)
您是否尝试在将父UIView添加为[myTableView setFrame:CGRectMake(parentView.frame.origin.x+5,parentView.frame.origin.y+5,parentView.frame.size.width-10,parentView.frame.size.height-10)];
之前或之后为UITableview设置框架?