问题描述
对于熟悉FPPopOver的用户: https://github.com/50pixels/FPPopover
For those that are familiar with FPPopOver: https://github.com/50pixels/FPPopover
单元格可以显示字幕吗?我必须将 UITableViewController
附加到笔尖.
Can the cells display subtitle? I had to attach my UITableViewController
to a nib.
在情节提要中,我设置了显示字幕的单元格,但是,当popOver出现在iPhone上时,只有 cell.textLabel.text
是可见的- cell.detailTextLabel.text
没有出现.
In the Storyboard I have the cell set up to show subtitle, however, when the popOver appears on the iPhone, only cell.textLabel.text
is visible - cell.detailTextLabel.text
is not appearing.
- (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";
}
这是图片:
更新在使用标签"显示字幕之后,将单元格滚动回视图后,将发生以下情况:
UpdateAfter using Labels to display the subtitle, after scrolling the cell back into the view, the following happens:
推荐答案
如果它根本不起作用,则可以选择使用lable并将lable的框架设置为详细文本,然后将该lable添加为cell.contentview addsubview这样,您就可以在表格视图单元格上获取详细信息文本.
if it's not working at all then alternative of that is you can use lable and set frame of lable as detail text has and add that lable as cell.contentview addsubview so this way you'll get your detail text on your tableview cell.
- (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;
}
这篇关于FPPoverover cell.detailTextLabel.text的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!