FPPoverover cell.detailTextLabel.text [英] FPPopover cell.detailTextLabel.text

查看:46
本文介绍了FPPoverover cell.detailTextLabel.text的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于熟悉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";

}

这是图片:

更新在使用标签"显示字幕之后,将单元格滚动回视图后,将发生以下情况:

Update After 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆