February 2014
Intermediate to advanced
560 pages
18h 58m
English
The image store will hold the pictures the user takes. In Chapter 18, you will have instances of BNRItem write out their instance variables to a file, which will then be read in when the application starts. However, because images tend to be very large, it is a good idea to keep them separate from other data. The image store will fetch and cache the images as they are needed. It will also be able to flush the cache if the device runs low on memory.
Create a new NSObject subclass called BNRImageStore. Open BNRImageStore.h and create its interface:
#import <Foundation/Foundation.h> @interface BNRImageStore : NSObject + (instancetype)sharedStore; - (void)setImage:(UIImage *)image forKey:(NSString *)key; - (UIImage ...
Read now
Unlock full access