作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的应用程序中,我使用表格 View 来显示可用视频的列表以及相关的一些详细信息。我已经使用 UIWebview
在用户选择视频时播放视频,现在我想在播放器下方的 webView
中显示视频的评论,最好的方法是什么为此,我知道 UITableView
很好,但我已经使用了 tableView
委托(delegate)并对其进行了自定义,现在我如何使用不同的 UITableview
委托(delegate)在同一个文件中。除了 tableView
之外,还有其他更好的方式来显示评论吗?
最佳答案
我们可以在同一个 viewcontroller
上使用两个 tableviews
,你可以通过给它们分配 tags
来区分它们……或者你也可以检查它们通过比较它们的内存
地址。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if(tableView.tag==1){
return [dataArray count];
}else{
return [dataArray1 count];
}}
或
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if(tableView==tableView1){
return [dataArray count];
}else{
return [dataArray1 count];
}}
关于ios - 如何在 iOS 中使用两个不同的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18737217/
我是一名优秀的程序员,十分优秀!