- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.sessionArray.count == 0) {
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
static NSString *MY = @"my";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MY];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MY];
UILabel *noMsgLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.view.bounds.size.height / 2, cell.frame.size.width, 59)];
noMsgLabel.text = @"暂无历史消息";
noMsgLabel.textColor = [UIColor darkGrayColor];
noMsgLabel.textAlignment = NSTextAlignmentCenter;
[cell.contentView addSubview:noMsgLabel];
cell.selectionStyle = UITableViewCellAccessoryNone;
}
return cell;
}
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
static NSString *sessioncellid = @"sessionCellidentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:sessioncellid];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sessioncellid];
}
cell.textLabel.text = @"今天太热了";
return cell;
}
ios 暂无聊天消息设置
最新推荐文章于 2025-12-03 13:11:09 发布
本文介绍了一种在iOS应用中实现消息列表视图的方法。通过使用UITableView展示消息记录,并根据不同情况调整显示样式,如当没有历史消息时,将显示提示信息;而当存在消息时,则会加载默认的消息内容。
2万+

被折叠的 条评论
为什么被折叠?



