2014-01-07 28 views
1

我有一个UITableViewController与底部的UIView。 (使用故事板)。我的UIView设置为隐藏,然后通过单击按钮更改状态。首先,我试图使用self.concluidoView.frame = CGRectMake(0, 0, 320, 50);来调整IBAction(buttonClick)上UIView的大小(基本上增加高度),但是UIView正在消失。现在UITableView扩展子视图后不够滚动

,它正确地用下面的代码里面IBAction扩大UIView

[UIView animateWithDuration:1.0 
        animations:^{ 
         CGRect frame = self.concluidoView.frame; 
         frame.size.height += 100.0; 
         self.concluidoView.frame = frame; 

        } 
        completion:^(BOOL finished){ 
         // complete 

        }]; 

的问题是,我的UITableViewController没有滚动足够的新的大小,因为UIView是我tableView的最后一个项目。

我已经尝试了几件事情来解决这个问题,包括手动尝试调整tableview以将其高度增加到UIView增加的相同值。我用下面的代码:

CGRect tableFrame = self.tableview.frame; 
     tableFrame.size.height += 100; 
     self.tableView.frame = tableFrame; 
     [self.tableview layoutIfNeeded]; 

tableview的滚动能力为这个代码后实际更小。我想调整tableview并允许手动滚动,因为我知道我的subview会增加多少或自动增加。

回答

1

如果你改变了UITableView的框架,你所要做的就是让它最有可能在屏幕外展开。你想要做的是得到表格视图来识别UIView更大。我假设这个UIView是你的UITableViewtableFooterView。试着做以下几点:

UIView *footerView = self.tableView.tableFooterView; 
self.tableView.tableFooterView = nil; 
self.tableView.tableFooterView = footerView; 

这将迫使UITableView重新审视页脚视图的大小。之前更改页脚视图的大小时,我不得不这样做。

+0

完美!这样做的工作,我有我的'UIView'在'@属性',所以我只是'tableFooterView'分配给它。谢谢。 – Jorge