且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在表格视图中设置相同尺寸的图像?

更新时间:2022-04-10 22:46:29

只需在 cellForRowAtIndexPart 部分

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

    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewStylePlain reuseIdentifier:CellIdentifier];
    }
    cell.imageView.frame = CGRectMake(50, 10, 200, 50);
    return cell;
}