Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I faced the same situation, and here is the solution I came with. My AQGridViewCell have both a TTImageView and a UIImageView. I use the TTImageView to load the image, and when it's loaded, I pass it to the UIImageView which displays it.</p> <p>To do that, my AQGridViewCell subclass implements the TTImageViewDelegate protocol. In my PostGridViewCell.h, I have :</p> <pre><code>@interface PostGridViewCell : AQGridViewCell &lt;TTImageViewDelegate&gt; { @private TTImageView *ttImageView_; UIImageView *imageView_; } // @property here … @end </code></pre> <p>In my implementation file, in the initWithFrame:reuseIdentifier: method, I init both my ttImageView and my imageView, but I only add the imageView as a subview of my cell. And I set the ttImageView delegate property to self (so I can be notified when the image is loaded) :</p> <pre><code>- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)aReuseIdentifier { if ((self = [super initWithFrame:frame reuseIdentifier:aReuseIdentifier])) { // init image ttImageView_ = [[TTImageView alloc] initWithFrame:CGRectZero]; ttImageView_.delegate = self; imageView_ = [[UIImageView alloc] initWithFrame:CGRectZero]; [self.contentView addSubview:imageView_]; // … } return self; } </code></pre> <p>When the TTImaveView has loaded the image, it calls the imageView:didLoadImage: method on the delegate (which is the PostGridViewCell). In my implementation file, I have this method :</p> <pre><code>- (void)imageView:(TTImageView*)imageView didLoadImage:(UIImage*)image { self.imageView.image = image; [self setNeedsLayout]; } </code></pre> <p>Does it help?<br> Cheers,<br> Thomas.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload