ios - 没有条目的 UITableView
<p><p>我有一个问题。在我的应用程序中,我有一个带有列表的 TableView,当我删除最后一条记录时,我希望在 TableView 上显示“没有更多数据”。谢谢!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if(self.searchUserResultList count==0))
{
// Display a message when the table is empty
UILabel *messageLabel = [ initWithFrame:CGRectMake(self.view.center.x-15, self.view.frame.size.height/2 , self.view.bounds.size.width, self.view.bounds.size.height)];
messageLabel.autoresizingMask=UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
messageLabel.text = @"NO SEARCH RESULTS" ;
messageLabel.textColor = ;
messageLabel.numberOfLines = 0;
messageLabel.textAlignment = NSTextAlignmentCenter;
messageLabel.font = ;
;
messageLabel.tag = 222;
messageLabel.frame = CGRectMake(self.view.center.x-(messageLabel.frame.size.width/2), self.view.frame.size.height/2, messageLabel.frame.size.width, messageLabel.frame.size.height);
;
self.tableView.hidden = YES;
return 0;
}
for (UIView* b in self.view.subviews)
{
if(b.tag == 222)
{
;
}
}
self.tableView.hidden = NO;
return 1;
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 没有条目的 UITableView,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/30299817/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/30299817/
</a>
</p>
页:
[1]