UITableViewCell的附带箭头未显示

时间:2014-11-17 07:52:47

标签: ios objective-c uitableview

我在xcode 6.1中制作应用程序。我想将tableview样式更改为UITableViewCellAccessoryDisclosureIndicator我已经编程并使用了故事板,但没有显示箭头。以下是我的代码的原因是什么。而当我通过故事板改变我的表视图样式时,它会在故事板中显示,但不会在模拟器上显示。

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

    static NSString *tableviewidentifier = @"Cell";
    UITableViewCell *cell= [self.My dequeueReusableCellWithIdentifier:tableviewidentifier];
    //cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellAccessoryDisclosureIndicator reuseIdentifier:tableviewidentifier];
    if(cell==nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:tableviewidentifier];
    }

    cell.textLabel.text = [[self.jsonresultarr objectAtIndex:indexPath.row] objectForKey:@"Brand_Name"];
    cell.textLabel.textColor=[UIColor brownColor];
    cell.textLabel.font=[UIFont fontWithName:@"Hoefler Text" size:17.0];
    // here just like follow ur other details
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
     cell.imageView.image=[UIImage imageNamed:@"drugs.jpg"];


    return cell;
}

2 个答案:

答案 0 :(得分:4)

我遇到了同样的问题,问题是故事板中的Tableview没有固定在右侧(作为约束)。 因此,在运行应用程序时,tableview结果比屏幕宽得多,因此隐藏了箭头。我通过正确设置约束来修复它。

答案 1 :(得分:0)

尝试在您的情节提要单元格选项中设置附件,"附件":

enter image description here