resize cell.UIImageView.image

前端 未结 4 825
暖寄归人
暖寄归人 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:10

    If your cell is a built in cell, it is supposed that the cell will resize all the images to a fixed, default size. Can you post an screenshot of your application as well?

    0 讨论(0)
  • 2021-01-07 11:15

    I just saw your question. I faced the same problem, and the code worked for me is following:

    cell.imageView.frame = CGRectMake(0, 0, 50, 50);

    Hope, it will solve your problem

    0 讨论(0)
  • 2021-01-07 11:23

    In case anybody else runs into this with custom cells: it appears that if your custom cell has an outlet named imageView, it will be treated like the image view in a basic-style cell, i.e. the image view's size will be adjusted. Simply picking another name avoids this behavior.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题