0

これは私がこれまでに試したことです

グローバル変数を定義しました

float imgHeight;

次に、- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath私はこれを行います

        size_t pixelsWide = CGImageGetWidth(scribbleImage.image.CGImage);
        size_t pixelsHigh = CGImageGetHeight(scribbleImage.image.CGImage);
        CGFloat ratio = 312/pixelsWide;
        pixelsHigh = pixelsHigh*ratio;

次に- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

return pixlesHeight;

heightForRowAtIndexPathが before と呼ばれるのでcellForRowAtIndexPath、常に を取得しpixelsHeight as 0ます。

これを行う別の方法がわかりません。heightForRow で UIImage を再定義してこれを行う必要があります

[scribbleImage setImageWithURL: [NSURL URLWithString:scribble[@"scribble_image"]] placeholderImage:[UIImage imageNamed:@"Default.png"]];

そこにも!? これを行う簡単な方法があるはずです。

4

1 に答える 1

0

heightForRowAtIndexPath でそれを行います。処理と読み込み時間の浪費に関する懸念を理解しているので、cellForRowAtIndexPathで同じものを使用するために、一度処理されたアイテムの配列内に UIImage を保存し、新しいものを作成しないようにします。

于 2013-07-16T13:41:08.050 に答える