2014-10-17 72 views
4

我正在使用自定义单元格创建表格视图。我已经使用xib文件来创建两者。我的桌子正在表演,因为我希望它,但只是一个问题表格的单元格没有显示泄露指标。配件披露指标未显示在自定义单元格中

该指标在xib文件中显示后,从属性检查器,但不是在模拟器。

我将它编程也

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

InboxTableViewCell * cell = (InboxTableViewCell *)[tableView   dequeueReusableCellWithIdentifier:[InboxTableViewCell reuseIdentifier]]; 


    if (cell == nil) 
    { 
     [[NSBundle mainBundle] loadNibNamed:customCellName owner:self options:nil]; 
     cell = _tblVIewInboxCell; 
     _tblVIewInboxCell = nil; 
    } 

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
    cell.lblTitleInbox.text = @"Title"; 
    cell.lblSubTitleInbox.font = [UIFont fontWithName:@"Verdana" size:16.0]; 
    cell.lblSubTitleInbox.text = @"SubTitle"; 
    cell.lblSubTitleInbox.font = [UIFont fontWithName:@"Verdana" size:12.0]; 

    return cell; 
} 

所以,任何人可以帮我。

在此先感谢。

+0

确保电池的宽度不超过320假如碰到了类似的问题。 – Sreejith 2014-10-17 16:56:06

+0

我也检查过..我保持它300以便在更安全的一面..但仍然不工作... – vaibhav 2014-10-18 06:32:43

回答

0

Try this

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) 
    { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; 
    } 
     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
    return cell; 

} 
+1

正如我在我的问题中说我使用自定义单元格,所以我不能使用tableView和测试目的我试过你的答案,但它不工作.. – vaibhav 2014-10-17 13:35:34

3

我有类似的问题;我已经将单元格内的元素(标签,图像)的所有约束添加到单元格边界,但它仍未显示最正确的元素和公开指示符。

原来你也必须为家长添加约束表查看其管理。界面故事板/自动布局不会为此发出任何警告。

这只是自定义TableView的情况。 TableViewController已经整理出来了,所以如果你从后者转向前者,很容易错过。

6

我有同样的问题,但我终于知道我已经实施了layoutSubviews方法,但忘记了在子类中调用super.layoutSubviews。如果你添加它,那么你可以看到披露。

因此,解决方案将是这样

class WQPlaneCell: UITableViewCell { 

    @IBOutlet private weak var thumbnailImage: UIImageView! 
    @IBOutlet private weak var planeNoLabel: UILabel! 
    @IBOutlet private weak var planeTypeLabel: UILabel! 
    @IBOutlet private weak var ownerLabel: UILabel! 

    override func layoutSubviews() { 
     super.layoutSubviews() // This is important, don't forget to call the super.layoutSubviews 
     .... // do anything you want 
    } 
} 
+0

没有别的工作,除了你的方法..谢谢你 – 2016-10-21 05:26:20

+0

这救了我的生命:) – Rajesh 2017-03-24 11:42:49

相关问题