resize cell.UIImageView.image

前端 未结 4 876
暖寄归人
暖寄归人 2021-01-07 11:02

i have the different image with the different size too, i want to put it in cell.imageView.image in every cell, but i want make same size in every cell although the image ha

4条回答
  •  自闭症患者
    2021-01-07 11:24

    I just ran into this same problem. I wanted the photos to be 65 x 65, but they were filling in the size of the UITableViewCell instead. I resolved it by creating the UIImageView programmatically and adding it as a subview to the UITableViewCell. For example:

    UIImageView *imageView = [[UIImageView alloc] initWithImage:photo];
    imageView.frame = CGRectMake(6.5, 6.5, 65., 65.);
    [cell addSubview:imageView];
    

    Edit for clarity: This problem was occurring when I tried to create the UIImageView in Interface Builder. I took it out of Interface Builder and added it programmatically instead.

提交回复
热议问题