When multiple _CPImageAndTextViews to share a common image, update them all when the image loads.

This commit is contained in:
Aparajita Fishman committed 2011-05-04 10:59:23 -04:00
1 parent 78ddc2db70
commit a0a7b126ab
1 file changed
+5 -8
+5 -8
View File
@@ -294,13 +294,13 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
return;
if ([_image delegate] === self)
[_image setDelegate:nil];
[[CPNotificationCenter defaultCenter] removeObserver:_image name:CPImageDidLoadNotification object:_image];
_image = anImage;
_flags |= _CPImageAndTextViewImageChangedFlag;
if ([_image loadStatus] !== CPImageLoadStatusCompleted)
[_image setDelegate:self];
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(imageDidLoad:) name:CPImageDidLoadNotification object:_image];
[self setNeedsLayout];
}
@@ -319,13 +319,10 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
return _imageOffset;
}
- (void)imageDidLoad:(id)anImage
- (void)imageDidLoad:(CPNotification)aNotification
{
if (anImage === _image)
{
_flags |= _CPImageAndTextViewImageChangedFlag;
[self setNeedsLayout];
}
_flags |= _CPImageAndTextViewImageChangedFlag;
[self setNeedsLayout];
}
- (CPImage)image