Fixed: CPProgressIndicator encoder wasted space and caused errors.

The errors would cause exceptions such as "Not allowed to load local resource: file:///<some local path from the machine that ran nib2cib>" when loading cib driven app through a web server.
This commit is contained in:
Alexander Ljungberg committed 2012-05-03 19:45:12 +01:00
1 parent 1476efce90
commit da055f83b3
1 file changed
+11
+11
View File
@@ -481,6 +481,8 @@ var CPProgressIndicatorSpinningStyleColors = nil,
_isAnimating = [aCoder decodeObjectForKey:@"_isAnimating"];
_isDisplayedWhenStoppedSet = [aCoder decodeObjectForKey:@"_isDisplayedWhenStoppedSet"];
_isDisplayedWhenStopped = [aCoder decodeObjectForKey:@"_isDisplayedWhenStopped"];
[self updateBackgroundColor];
}
return self;
@@ -488,7 +490,16 @@ var CPProgressIndicatorSpinningStyleColors = nil,
- (void)encodeWithCoder:(CPCoder)aCoder
{
// Don't encode the subviews or background colour. They can be recreated based on the flags and if encoded cause hardcoded
// image paths in the cib while just wasting space.
// TODO Maybe just switch them for ephemeral views.
var subviews = [self subviews],
backgroundColor = [self backgroundColor];
[self setSubviews:[]];
[self setBackgroundColor:nil];
[super encodeWithCoder:aCoder];
[self setSubviews:subviews];
[self setBackgroundColor:backgroundColor];
[aCoder encodeObject:_minValue forKey:@"_minValue"];
[aCoder encodeObject:_maxValue forKey:@"_maxValue"];