[英]FPPopover cell.detailTextLabel.text
对于那些熟悉FPPopOver的人: https : //github.com/50pixels/FPPopover
单元格可以显示字幕吗? 我不得不将UITableViewController
附加到笔尖。
在情节提要中,我设置了显示字幕的单元格,但是,当popOver出现在iPhone上时,仅cell.textLabel.text
是可见的cell.detailTextLabel.text
不出现。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell==nil)
{
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSString *entityName= [[managedObject entity]name];
cell.textLabel.text = [NSString stringWithFormat:@"%@ %i", entityName, [indexPath row]];
cell.detailTextLabel.text = @"Subtitle";
}
这是图片:
更新使用标签显示字幕后,将单元格滚动回视图后,将发生以下情况:
如果它根本不起作用,那么您可以使用lable并将lable的框架设置为详细文本,然后将该lable添加为cell.contentview addsubview,这样您就可以在tableview单元格上获取详细文本。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = (UITableViewCell*)[tblUser dequeueReusableCellWithIdentifier:nil];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
}
NSMutableDictionary *objUser = [arrUser objectAtIndex:indexPath.row];
strName = [objUser objectForKey:@"Name"];
strDate = [objUser objectForKey:@"Date"];
UILabel *lblName = [[UILabel alloc] initWithFrame:CGRectMake(85, 10, 215, 20)];
lblName.text = strName;
lblName.textColor = [UIColor whiteColor];
[lblName setBackgroundColor:[UIColor clearColor]];
[cell.contentView addSubview:lblName];
UILabel *lblDate = [[UILabel alloc] initWithFrame:CGRectMake(85, 34, 215, 20)];
lblDate.text = strDate;
lblDate.textColor = [UIColor whiteColor];
[lblDate setBackgroundColor:[UIColor clearColor]];
[cell.contentView addSubview:lblDate];
return cell;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.