UITableView 查询结果为空,显示无数据的方法
2016-02-02 21:32
633 查看
#pragma mark - UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if (self.articles.count) { self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; self.tableView.backgroundView = nil; return 1; } else { self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; UILabel *label = [[UILabel alloc] initWithFrame:self.tableView.bounds]; label.text = @"没有搜索到相关文章\n请输入其它关键字再次搜索"; label.numberOfLines = 2; label.textAlignment = NSTextAlignmentCenter; label.textColor = [UIColor lightGrayColor]; self.tableView.backgroundView = label; } return 0; }
相关文章推荐
- Fuel Openstack 7.0在Virtualbox中部署
- 1017. Queueing at Bank (25)
- 环状序列(Circular Sequence, ACM/ICPC Seoul 2004, UVa1584)
- JDBC获得数据库连接时写在URL上的?useUnicode=true&characterEncoding=utf-8的意义
- UESTC 1272 Final Pan's prime numbers(乱搞)
- Number Sequence
- Easyui datagrid行内【添加】、【编辑】、【上移】、【下移】
- 查看磁盘UUID
- HDU 1005 Number Sequence 数学题
- uiview的绘画
- ABP框架实践基础篇之开发UI层
- UICollectionView移动cell
- UESTC 1273 God Qing's circuital law
- 1.UiDevice API 详细介绍
- UESTC 1272 Final Pan's prime numbers
- UESTC 1271 Search gold
- Convert Stream to UIImage
- UESTC 1270 Playfair
- UESTC 1269 ZhangYu Speech
- Convert UIImage to Stream