diff --git a/CLCGCell.h b/CLCGCell.h index 43e7b8f..96e4efb 100644 --- a/CLCGCell.h +++ b/CLCGCell.h @@ -63,7 +63,6 @@ // properties declared in CLCGCell protocol @property(nonatomic,assign) BOOL emphasized; -@property(nonatomic,readonly) CGFloat viewportPadding; @property(nonatomic) CGFloat innerPadding; @property(nonatomic,retain) UIColor *normalColor; @property(nonatomic,retain) UIColor *emphasisColor; diff --git a/CLCGCell.m b/CLCGCell.m index 27929be..c0f7a21 100644 --- a/CLCGCell.m +++ b/CLCGCell.m @@ -92,7 +92,7 @@ -(id)initWithImageWidth:(CGFloat)w if (self) { _imgW = w; _imgH = h; - _viewportPadding = _innerPadding = padding; + _innerPadding = padding; [self setCommonLayouter:[[CLCGCellCommonLayouter alloc] initWithCell:self]]; [self setSelectionStyle:UITableViewCellSelectionStyleBlue]; [[self textLabel] setTextColor:[UIColor blackColor]]; @@ -176,7 +176,7 @@ -(void)layoutSubviews [super layoutSubviews]; // layout image view - const CGRect img_frame = CGRectMake(_viewportPadding, [class topBottomPadding], + const CGRect img_frame = CGRectMake([class viewportPadding], [class topBottomPadding], _imgW, _imgH); [_mainImageView setFrame:img_frame]; @@ -348,6 +348,7 @@ -(void)loadImageForURL:(NSString*)img_url context:(id)cell_cxt_obj { [self setContext:cell_cxt_obj]; + [self showImage:nil]; //avoid showing previous image on a recycled cell [CLCGImageLoader loadImageForURL:img_url retinaURL:retina_img_url useCache:YES diff --git a/CLCGCellCommonLayouter.h b/CLCGCellCommonLayouter.h index 86aee64..ace0680 100644 --- a/CLCGCellCommonLayouter.h +++ b/CLCGCellCommonLayouter.h @@ -53,12 +53,11 @@ @property(nonatomic,retain) UIView *backgroundView; @property(nonatomic,readonly,retain) UIImageView *imageView NS_AVAILABLE_IOS(3_0); -- (void)setNeedsLayout; @property(nonatomic,assign) BOOL emphasized; -@property(nonatomic,readonly) CGFloat viewportPadding; @property(nonatomic,readonly) CGFloat innerPadding; @property(nonatomic,retain) UIColor *normalColor; @property(nonatomic,retain) UIColor *emphasisColor; +- (void)setNeedsDisplay; @end diff --git a/CLCGCellCommonLayouter.m b/CLCGCellCommonLayouter.m index 88f2762..b9331df 100644 --- a/CLCGCellCommonLayouter.m +++ b/CLCGCellCommonLayouter.m @@ -70,8 +70,7 @@ -(void)showImage:(UIImage*)img animated:(BOOL)animated CALayer *layer = [[_cell imageView] layer]; if (animated) { - // once the img view has been layed out once, no need to re-lay it out again - [_cell setNeedsLayout]; //layout will happen in next update cycle + [_cell setNeedsDisplay]; CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"opacity"]; [anim setDuration:0.4]; // seconds [anim setFromValue:[NSNumber numberWithFloat:0.0]]; diff --git a/clcg_debug.h b/clcg_debug.h index 919d52e..d996a57 100644 --- a/clcg_debug.h +++ b/clcg_debug.h @@ -101,6 +101,17 @@ if (am_i_being_debugged()) { __asm__("int $3\n" : : ); }; } \ #endif // #ifdef DEBUG #define CLCGASSERT CLCG_ASSERT + +/////////////////////////////////////////////////////////////////////////////// +// exception macro + +#ifdef DEBUG +#define CLCG_INCONSISTENCY(msg,obj) {[NSException raise:NSInternalInconsistencyException format:@"%@ Class: %@",msg,NSStringFromClass([obj class])];} +#else +#define CLCG_INCONSISTENCY(msg,obj) ((void)0) +#endif + + #ifdef __cplusplus } #endif