UITableView单元格ImageView问题

Ban*_*ore 2 image objective-c uitableview ios

嗨,
UITableView在课堂上有一个,当我尝试加载内容时,出现了这样的屏幕

在此处输入图片说明

白框下方无法看到水平分隔线,请帮助我。

我的代码:

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;    //count of section
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return [names count];    //count number of row from counting array hear cataGorry is An Array
}


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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];

    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                       reuseIdentifier:MyIdentifier]
        ;
    }

    // Here we use the provided setImageWithURL: method to load the web image
    // Ensure you use a placeholder image otherwise cells will be initialized with no image
    cell.imageView.frame=CGRectMake(5,10,50,60);
    cell.imageView.image=[imaages objectAtIndex:indexPath.row];
    cell.textLabel.text = [names objectAtIndex:indexPath.row];
    cell.backgroundColor=[UIColor clearColor];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

    return 80;

}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
Run Code Online (Sandbox Code Playgroud)

Paw*_*Rai 5

在您的视图中写确实加载

在iOS 7及更高版本中,单元格分隔符不会一直延伸到表格视图的边缘。此属性为表格中的所有单元格设置默认插入点,就像rowHeight设置单元格的默认高度一样。它还用于管理在普通样式表底部绘制的“额外”分隔符。

// Do any additional setup after loading the view.
if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [_tableView setSeparatorInset:UIEdgeInsetsZero];
}
Run Code Online (Sandbox Code Playgroud)