2013-03-25 73 views

回答

0

YIF你把你的UITableView動態的UIView,嘗試設置autoresizingMask:

tableView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); 

,然後添加的tableView爲子視圖:

[view addSubView:tableView]; 

希望這有助於

+0

我不是動態創建我的表格,而是使用故事板。我試圖以編程方式執行它,但不幸的是它沒有工作。 – 2013-03-25 14:18:49

0

您是否嘗試過在添加父UIView之前或之後爲UITableview設置框架,如[myTableView setFrame:CGRectMake(parentView.frame.origin.x+5,parentView.frame.origin.y+5,parentView.frame.size.width-10,parentView.frame.size.height-10)];

+0

我不能設置表格的框架,我希望它適合超級視圖的大小(UIView) – 2013-03-25 14:05:29

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; 
} 
相關問題