2012-05-12 150 views
-6

我遇到了问题,在同一视图中的静态TableView和动态表视图

我需要在同一视图中有2个表视图。

第一个必须是静态tableview和第二个动态。

的看法应该是这样的

The view should look like this

enter image description here

感谢您的帮助:)

+0

问题是什么?你的问题似乎就像你在说什么不问? – rishi

+0

[在表格视图中组合静态和原型内容]的可能的重复(http://stackoverflow.com/questions/9322885/combine-static-and-prototype-content-in-a-table-view) – lnafziger

回答

2

定制你的tableview静态的tableView 必须被嵌入在一个UITableViewController,它会自动它扩展到完整可用大小,所以你不能在它另一种看法。

但是,您可以通过使用两个动态表视图并将它们嵌入到标准视图控制器中来完成要执行的操作。您必须制作多个原型单元格,并根据要求的行而不是静态表格视图返回适当的单元格。

1

创建的UITableView的两个实例和合成它们。将两者的委托和数据源设置为self。定义框架并将它们添加到您的视图。符合UITableAViewDelegate。他们使用的委托方法

+0

这不会使用静态表格视图。 – lnafziger

1

解决方案:在静态的tableview调用超级tableviewdatasource和委托方法, 动态的tableview,回到你自己的东西

你必须检查它的tableview是在每一个tableviewdelegate和数据源功能的情况。

例如:

- (NSInteger)tableView:(UITableView *)tableView 
numberOfRowsInSection:(NSInteger)section 
{ 
    //messagetableview is one with dynamic content 
    if(tableView != messageTableview) 
    { 
     //super is called when static content is in case 
     return [super tableView:tableView numberOfRowsInSection:section]; 

    } 
    else 
    { 
     //return dynamic count 
     return [conversation messagecount]; 
    } 

}