UIImage-NSCoding.h
//
// UIImage-NSCoding.h
UIImage-NSCoding.m
//
// UIImage-NSCoding.m
This is also checked into Google Code if you prefer to grab it from there.
The Top 100 Gadget Blogs ranking is here to help you find out which of the gadget blogs from around the world are the ones to watch out for.
//
// UIImage-NSCoding.h
#import <Foundation/Foundation.h>
@interface UIImageNSCoding <NSCoding>
- (id)initWithCoder:(NSCoder *)decoder;
- (void)encodeWithCoder:(NSCoder *)encoder;
@end
//
// UIImage-NSCoding.m
#import "UIImage-NSCoding.h"
#define kEncodingKey @"UIImage"
@implementation UIImage(NSCoding)
- (id)initWithCoder:(NSCoder *)decoder
{
if ((self = [super init]))
{
NSData *data = [decoder decodeObjectForKey:kEncodingKey];
self = [self initWithData:data];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)encoder
{
NSData *data = UIImagePNGRepresentation(self);
[encoder encodeObject:data forKey:kEncodingKey];
}
@end
0 komentar:
Post a Comment