Dou*_*ith 3 objective-c uitableview uiview ios
与Apple在音乐应用中的表现类似:

我希望有一个UITableViewController,但如果有内容,我最好只展示单元格,否则显示"无内容"消息.只是放在UIView表格视图的顶部?
根据需要设计无内容视图(UIView),将该视图添加到self.view并将其放置在表视图的顶部.最初隐藏它.然后在inside - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section方法中,你可以做这样的事情.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
int count = songsArray.count;
if(count==0){
self.noContentView.hidden = NO;
}else{
self.noContentView.hidden = YES;
}
return count;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2014 次 |
| 最近记录: |