1

目前我有两种在单元格中显示图像的方式,哪种方式有助于表格顺利运行,我稍后会使用lazytable?在每个单元格中应该给按钮一个 setimage 还是添加一个带有 set image 的 imageview 一样好?同样在第一种方法中,我必须动态缩放每个图像。谢谢!

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

UIImage *img = [UIImage imageWithData:"png image from url"];

[button setImage:img forState:UIControlStateNormal];


/// Or


UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

UIImage *img = [UIImage imageWithData:"png image from url"];

UIImageView *imageView2 = [[UIImageView alloc] initWithImage:img];

[button2 addSubview:imageView2];
4

1 回答 1

0

既然按钮有图像属性,为什么要给按钮添加图像视图,推荐使用方法1

于 2012-07-01T19:34:35.823 回答