mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-01 18:58:22 +00:00
When multiple _CPImageAndTextViews to share a common image, update them all when the image loads.
This commit is contained in:
1 parent
78ddc2db70
commit
a0a7b126ab
1 file changed
+5
-8
@@ -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
|
||||
|
||||
Reference in new issue
Block a user