我有一堆用于细胞图像视图的图像,它们都不超过50x50.例如40x50,50x32,20x37 .....
当我加载表格视图时,文本不会排列,因为图像的宽度会有所不同.此外,我希望小图像出现在中心而不是左侧.
这是我在'cellForRowAtIndexPath'方法中尝试的代码
cell.imageView.autoresizingMask = ( UIViewAutoresizingNone );
cell.imageView.autoresizesSubviews = NO;
cell.imageView.contentMode = UIViewContentModeCenter;
cell.imageView.bounds = CGRectMake(0, 0, 50, 50);
cell.imageView.frame = CGRectMake(0, 0, 50, 50);
cell.imageView.image = [UIImage imageWithData: imageData];
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,我尝试了一些东西,但它们都没有用.