1

現在、セルに画像を表示する方法は 2 つあります。テーブルをスムーズに実行するのに役立つ方法はどれですか。後で lazytable を使用しますか? 各セルでは、ボタンに setimage を指定する必要がありますか? また、最初の方法では、各画像を動的にスケーリングする必要があります。ありがとうございました!

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 に答える