├── .gitignore ├── LICENSE ├── README.md └── src ├── KTDownloadManager ├── KTDownloadManager.h ├── KTDownloadManager.m ├── KTDownloadManagerDelegate.h ├── KTDownloader.h ├── KTDownloader.m ├── KTDownloaderDelegate.h ├── KTFileCache.h └── KTFileCache.m └── Sample ├── Classes ├── MyDownloadManager.h ├── MyDownloadManager.m ├── SampleAppDelegate.h ├── SampleAppDelegate.m ├── SampleViewController.h └── SampleViewController.m ├── MainWindow.xib ├── Sample-Info.plist ├── Sample.xcodeproj └── project.pbxproj ├── SampleViewController.xib ├── Sample_Prefix.pch └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | *.pbxuser 4 | *.mode2v3 5 | *.mode1v3 6 | *.perspective 7 | *.perspectivev3 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 White Peak Software Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | KTDownloadManager 2 | ================= 3 | 4 | A download and cache manager for iOS applications used to download and cache data retrieved from the web. More to come soon. -------------------------------------------------------------------------------- /src/KTDownloadManager/KTDownloadManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // KTDownloadManager.h 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KTDownloaderDelegate.h" 11 | #import "KTDownloadManagerDelegate.h" 12 | 13 | extern NSString * const ktDownloadManagerResponseKeyData; 14 | extern NSString * const ktDownloadManagerResponseKeyFileURL; 15 | 16 | 17 | enum { 18 | KTDownloadManagerResponseTypeNone = 0, 19 | KTDownloadManagerResponseTypeData = 1 << 0, 20 | KTDownloadManagerResponseTypeFileURL = 1 << 1 21 | }; 22 | typedef NSUInteger KTDownloadManagerResponseType; 23 | 24 | @class KTDownloader; 25 | 26 | @interface KTDownloadManager : NSObject { 27 | id downloadManagerDelegate_; 28 | @private 29 | NSMutableSet *downloaderTable_; 30 | } 31 | 32 | @property (nonatomic, assign) id delegate; 33 | 34 | - (void)downloadDataWithURL:(NSURL *)url tag:(NSInteger)tag responseType:(KTDownloadManagerResponseType)respType; 35 | 36 | /** 37 | * Returns the data downloaded from the URL. This should ONLY be called 38 | * after the data has been downloaded. 39 | */ 40 | - (NSData *)dataWithURL:(NSURL *)url; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /src/KTDownloadManager/KTDownloadManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // KTDownloadManager.m 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import "KTDownloadManager.h" 10 | #import "KTDownloader.h" 11 | #import "KTFileCache.h" 12 | 13 | 14 | NSString * const ktDownloadManagerResponseKeyData = @"KTDownloadManager.data"; 15 | NSString * const ktDownloadManagerResponseKeyFileURL = @"KTDownloadManager.fileURL"; 16 | 17 | 18 | @interface KTDownloadManager (KTPrivateMethods) 19 | - (void)broadcastDidFinishWithResponseData:(NSDictionary *)respData tag:(NSInteger)tag; 20 | - (void)downloader:(KTDownloader *)downloader didFinishWithData:(NSData *)data; 21 | - (void)downloader:(KTDownloader *)downloader didFailWithError:(NSError *)error; 22 | @end 23 | 24 | @implementation KTDownloadManager 25 | 26 | @synthesize delegate = downloadManagerDelegate_; 27 | 28 | - (void)dealloc 29 | { 30 | [downloaderTable_ release], downloaderTable_ = nil; 31 | 32 | [super dealloc]; 33 | } 34 | 35 | - (id)init 36 | { 37 | self = [super init]; 38 | if (self) { 39 | downloaderTable_ = [[NSMutableSet alloc] init]; 40 | } 41 | return self; 42 | } 43 | 44 | - (void)downloadDataWithURL:(NSURL *)url 45 | tag:(NSInteger)tag 46 | responseType:(KTDownloadManagerResponseType)respType; 47 | { 48 | NSString *key = [url absoluteString]; 49 | 50 | KTFileCache *cache = [KTFileCache sharedKTFileCache]; 51 | NSMutableDictionary *responseData = [[NSMutableDictionary alloc] init]; 52 | NSURL *fileURL = nil; 53 | NSData *data = nil; 54 | 55 | // Retrieve the file URL from the cache. 56 | if ((respType & KTDownloadManagerResponseTypeFileURL) == KTDownloadManagerResponseTypeFileURL) { 57 | fileURL = [cache fileURLWithKey:key]; 58 | if (fileURL) { 59 | [responseData setObject:fileURL forKey:ktDownloadManagerResponseKeyFileURL]; 60 | } 61 | } 62 | 63 | // If the response type includes data then 64 | // retrieve data from the cache. 65 | if ((respType & KTDownloadManagerResponseTypeData) == KTDownloadManagerResponseTypeData) { 66 | data = [cache dataWithKey:key]; 67 | if (data) { 68 | [responseData setObject:data forKey:ktDownloadManagerResponseKeyData]; 69 | } 70 | } 71 | 72 | if ((respType & KTDownloadManagerResponseTypeData) == KTDownloadManagerResponseTypeData && data) { 73 | // No need to download. We have the data cached in memory. 74 | [self broadcastDidFinishWithResponseData:responseData tag:tag]; 75 | } else if ((respType & KTDownloadManagerResponseTypeFileURL) == KTDownloadManagerResponseTypeFileURL && fileURL) { 76 | [self broadcastDidFinishWithResponseData:responseData tag:tag]; 77 | } else { 78 | KTDownloader *downloader = [KTDownloader newDownloaderWithURL:url 79 | tag:tag 80 | responseType:respType 81 | downloadManager:self]; 82 | [downloaderTable_ addObject:downloader]; 83 | [downloader start]; 84 | } 85 | } 86 | 87 | - (NSData *)dataWithURL:(NSURL *)url 88 | { 89 | NSString *key = [url absoluteString]; 90 | KTFileCache *cache = [KTFileCache sharedKTFileCache]; 91 | NSData *data = [cache dataWithKey:key]; 92 | 93 | return data; 94 | } 95 | 96 | 97 | #pragma mark - 98 | #pragma mark Delegate broadcast helpers 99 | 100 | - (void)broadcastDidFinishWithResponseData:(NSDictionary *)respData tag:(NSInteger)tag 101 | { 102 | if (downloadManagerDelegate_ && [downloadManagerDelegate_ respondsToSelector:@selector(downloadManagerDidFinishWithResponseData:tag:)]) { 103 | [downloadManagerDelegate_ downloadManagerDidFinishWithResponseData:respData tag:tag]; 104 | } 105 | } 106 | 107 | 108 | #pragma mark - 109 | #pragma mark KTDownloaderDelegate Methods 110 | 111 | - (void)downloader:(KTDownloader *)downloader didFinishWithData:(NSData *)data; 112 | { 113 | NSString *key = [[downloader url] absoluteString]; 114 | NSInteger tag = [downloader tag]; 115 | KTDownloadManagerResponseType respType = [downloader responseType]; 116 | NSURL *fileURL = nil; 117 | 118 | NSMutableDictionary *responseData = [[NSMutableDictionary alloc] init]; 119 | 120 | // Prepare cache. 121 | BOOL cacheToDisk = NO; 122 | BOOL cacheToMemory = NO; 123 | cacheToMemory = ((respType & KTDownloadManagerResponseTypeData) == KTDownloadManagerResponseTypeData); 124 | cacheToDisk = ((respType & KTDownloadManagerResponseTypeFileURL) == KTDownloadManagerResponseTypeFileURL); 125 | 126 | // Cache data. 127 | if (respType != KTDownloadManagerResponseTypeNone) { 128 | KTFileCache *cache = [KTFileCache sharedKTFileCache]; 129 | [cache storeData:data forKey:key toDisk:cacheToDisk toMemory:cacheToMemory]; 130 | fileURL = [cache fileURLWithKey:key]; 131 | } 132 | 133 | // Prepare responseData. 134 | if ((respType & KTDownloadManagerResponseTypeData) == KTDownloadManagerResponseTypeData) { 135 | [responseData setObject:data forKey:ktDownloadManagerResponseKeyData]; 136 | } 137 | if ((respType & KTDownloadManagerResponseTypeFileURL) == KTDownloadManagerResponseTypeFileURL) { 138 | [responseData setObject:fileURL forKey:ktDownloadManagerResponseKeyFileURL]; 139 | } 140 | 141 | // Release the downloader. 142 | [downloaderTable_ removeObject:downloader]; 143 | [downloader release]; 144 | 145 | // Return the response data to the caller. 146 | [self broadcastDidFinishWithResponseData:responseData tag:tag]; 147 | } 148 | 149 | - (void)downloader:(KTDownloader *)downloader didFailWithError:(NSError *)error 150 | { 151 | if (downloadManagerDelegate_ && [downloadManagerDelegate_ respondsToSelector:@selector(downloadManagerDidFailWithError:)]) { 152 | [downloadManagerDelegate_ downloadManagerDidFailWithError:error]; 153 | } 154 | 155 | // Release the downloader. 156 | [downloaderTable_ removeObject:downloader]; 157 | [downloader release]; 158 | } 159 | 160 | 161 | @end 162 | -------------------------------------------------------------------------------- /src/KTDownloadManager/KTDownloadManagerDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // KTDownloadManagerDelegate.h 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class KTDownloader; 12 | 13 | @protocol KTDownloadManagerDelegate 14 | 15 | @optional 16 | - (void)downloadManagerDidFinishWithResponseData:(NSDictionary *)respData tag:(NSInteger)tag; 17 | - (void)downloadManagerDidFailWithError:(NSError *)error; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /src/KTDownloadManager/KTDownloader.h: -------------------------------------------------------------------------------- 1 | // 2 | // KTDownloadManager.h 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KTDownloadManager.h" 11 | 12 | #define KTDownloaderErrorDomain @"KTDownloader Download Error Domain" 13 | 14 | enum { 15 | KTDownloaderErrorNoConnection = 1000, 16 | }; 17 | 18 | @interface KTDownloader : NSObject { 19 | NSURL *url_; 20 | NSInteger tag_; 21 | KTDownloadManagerResponseType responseType_; 22 | @private 23 | KTDownloadManager *downloadManager_; 24 | NSMutableData *receivedData_; 25 | } 26 | 27 | @property (nonatomic, retain) NSURL *url; 28 | @property (nonatomic, assign) NSInteger tag; 29 | @property (nonatomic, assign) KTDownloadManagerResponseType responseType; 30 | 31 | + (KTDownloader *)newDownloaderWithURL:(NSURL *)url 32 | tag:(NSInteger)tag 33 | responseType:(KTDownloadManagerResponseType)respType 34 | downloadManager:(KTDownloadManager *)downloadManager; 35 | 36 | - (void)start; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /src/KTDownloadManager/KTDownloader.m: -------------------------------------------------------------------------------- 1 | // 2 | // KTDownloadManager.m 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import "KTDownloader.h" 10 | #import "KTDownloadManager.h" 11 | 12 | @interface KTDownloader () 13 | @property (nonatomic, assign) KTDownloadManager *downloadManager; 14 | @property (nonatomic, retain) NSMutableData *receivedData; 15 | @end 16 | 17 | 18 | @implementation KTDownloader 19 | 20 | @synthesize url = url_; 21 | @synthesize downloadManager = downloadManager_; 22 | @synthesize receivedData = receivedData_; 23 | @synthesize tag = tag_; 24 | @synthesize responseType = responseType_; 25 | 26 | - (void)dealloc 27 | { 28 | [url_ release], url_ = nil; 29 | [receivedData_ release], receivedData_ = nil; 30 | 31 | [super dealloc]; 32 | } 33 | 34 | + (KTDownloader *)newDownloaderWithURL:(NSURL *)url 35 | tag:(NSInteger)tag 36 | responseType:(KTDownloadManagerResponseType)respType 37 | downloadManager:(KTDownloadManager *)downloadManager 38 | { 39 | KTDownloader *downloader = [[KTDownloader alloc] init]; 40 | [downloader setUrl:url]; 41 | [downloader setTag:tag]; 42 | [downloader setResponseType:respType]; 43 | [downloader setDownloadManager:downloadManager]; 44 | return downloader; 45 | } 46 | 47 | - (void)start 48 | { 49 | NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url_]; 50 | NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request 51 | delegate:self 52 | startImmediately:NO]; 53 | [request release]; 54 | 55 | [connection scheduleInRunLoop:[NSRunLoop currentRunLoop] 56 | forMode:NSRunLoopCommonModes]; 57 | [connection start]; 58 | 59 | if (connection) { 60 | NSMutableData *data = [[NSMutableData alloc] init]; 61 | [self setReceivedData:data]; 62 | [data release]; 63 | } else { 64 | NSError *error = [NSError errorWithDomain:KTDownloaderErrorDomain 65 | code:KTDownloaderErrorNoConnection 66 | userInfo:nil]; 67 | if (downloadManager_) { 68 | [downloadManager_ downloader:self didFailWithError:error]; 69 | } 70 | } 71 | } 72 | 73 | 74 | #pragma mark - 75 | #pragma mark NSURLConnection delegates 76 | 77 | - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 78 | { 79 | [[self receivedData] setLength:0]; 80 | } 81 | 82 | - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 83 | { 84 | [[self receivedData] appendData:data]; 85 | } 86 | 87 | - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 88 | { 89 | [connection release]; 90 | if (downloadManager_) { 91 | [downloadManager_ downloader:self didFailWithError:error]; 92 | } 93 | } 94 | 95 | - (void)connectionDidFinishLoading:(NSURLConnection *)connection 96 | { 97 | [connection release]; 98 | 99 | NSData *data = [self receivedData]; 100 | [downloadManager_ downloader:self didFinishWithData:data]; 101 | } 102 | 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /src/KTDownloadManager/KTDownloaderDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // KTDownloaderDelegate.h 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class KTDownloader; 12 | 13 | @protocol KTDownloaderDelegate 14 | @required 15 | - (void)downloader:(KTDownloader *)downloader didFinishWithData:(NSData *)data; 16 | - (void)downloader:(KTDownloader *)downloader didFailWithError:(NSError *)error; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /src/KTDownloadManager/KTFileCache.h: -------------------------------------------------------------------------------- 1 | // 2 | // KTFileCache.h 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface KTFileCache : NSObject { 13 | NSMutableDictionary *memoryCache_; 14 | NSString *diskCachePath_; 15 | NSOperationQueue *cacheInQueue_; 16 | } 17 | 18 | + (KTFileCache *)sharedKTFileCache; 19 | - (void)storeData:(NSData *)data forKey:(NSString *)key toDisk:(BOOL)toDisk toMemory:(BOOL)toMemory; 20 | - (NSData *)dataWithKey:(NSString *)key; 21 | - (NSURL *)fileURLWithKey:(NSString *)key; 22 | - (void)clearMemory; 23 | - (void)clearDisk; 24 | - (void)cleanDisk; 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /src/KTDownloadManager/KTFileCache.m: -------------------------------------------------------------------------------- 1 | // 2 | // KTFileCache.m 3 | // KTDownloadManager 4 | // 5 | // Created by Kirby Turner on 4/15/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | // The following code is inspired by and derived from SDWebImage. 9 | // http://github.com/rs/SDWebImage 10 | // 11 | 12 | #import "KTFileCache.h" 13 | #import 14 | 15 | 16 | static NSInteger cacheMaxCacheAge = 60*60*24*7; // 1 week 17 | 18 | 19 | @interface KTFileCache (KTPrivateMethods) 20 | - (NSString *)cachePathForKey:(NSString *)key; 21 | - (void)storeData:(NSData *)data toDiskForKey:(NSString *)key; 22 | - (NSString *)pathExtensionWithKey:(NSString *)key; 23 | @end 24 | 25 | @implementation KTFileCache 26 | 27 | - (void)dealloc 28 | { 29 | [memoryCache_ release], memoryCache_ = nil; 30 | [diskCachePath_ release], diskCachePath_ = nil; 31 | [cacheInQueue_ release], cacheInQueue_ = nil; 32 | 33 | [[NSNotificationCenter defaultCenter] removeObserver:self 34 | name:UIApplicationDidReceiveMemoryWarningNotification 35 | object:nil]; 36 | 37 | [[NSNotificationCenter defaultCenter] removeObserver:self 38 | name:UIApplicationWillTerminateNotification 39 | object:nil]; 40 | 41 | if (&UIApplicationDidEnterBackgroundNotification) { 42 | [[NSNotificationCenter defaultCenter] removeObserver:self 43 | name:UIApplicationDidEnterBackgroundNotification 44 | object:nil]; 45 | } 46 | 47 | [super dealloc]; 48 | } 49 | 50 | - (id)init 51 | { 52 | self = [super init]; 53 | if (self) { 54 | // Initial the memory cache. 55 | memoryCache_ = [[NSMutableDictionary alloc] init]; 56 | 57 | // Initial the disk cache. 58 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); 59 | diskCachePath_ = [[[paths objectAtIndex:0] stringByAppendingPathComponent:@"KTFileCache"] retain]; 60 | 61 | if (![[NSFileManager defaultManager] fileExistsAtPath:diskCachePath_]) { 62 | [[NSFileManager defaultManager] createDirectoryAtPath:diskCachePath_ withIntermediateDirectories:YES attributes:nil error:NULL]; 63 | } 64 | 65 | // Initial the operation queue. 66 | cacheInQueue_ = [[NSOperationQueue alloc] init]; 67 | [cacheInQueue_ setMaxConcurrentOperationCount:2]; 68 | 69 | // Subscribe to application events. 70 | [[NSNotificationCenter defaultCenter] addObserver:self 71 | selector:@selector(didReceiveMemoryWarning:) 72 | name:UIApplicationDidReceiveMemoryWarningNotification 73 | object:nil]; 74 | 75 | [[NSNotificationCenter defaultCenter] addObserver:self 76 | selector:@selector(willTerminate) 77 | name:UIApplicationWillTerminateNotification 78 | object:nil]; 79 | 80 | if (&UIApplicationDidEnterBackgroundNotification) { 81 | [[NSNotificationCenter defaultCenter] addObserver:self 82 | selector:@selector(willTerminate) 83 | name:UIApplicationDidEnterBackgroundNotification 84 | object:nil]; 85 | } 86 | } 87 | return self; 88 | } 89 | 90 | #pragma mark - 91 | #pragma mark Notification Handlers 92 | 93 | - (void)didReceiveMemoryWarning:(void *)object 94 | { 95 | [self clearMemory]; 96 | } 97 | 98 | - (void)willTerminate 99 | { 100 | [self cleanDisk]; 101 | } 102 | 103 | 104 | #pragma mark - 105 | #pragma mark Private methods 106 | 107 | - (NSString *)cachePathForKey:(NSString *)key 108 | { 109 | NSString *pathExtension = [self pathExtensionWithKey:key]; 110 | const char *str = [key UTF8String]; 111 | unsigned char r[CC_MD5_DIGEST_LENGTH]; 112 | CC_MD5(str, strlen(str), r); 113 | NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", 114 | r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]]; 115 | 116 | if (pathExtension) { 117 | filename = [filename stringByAppendingPathExtension:pathExtension]; 118 | } 119 | 120 | return [diskCachePath_ stringByAppendingPathComponent:filename]; 121 | } 122 | 123 | - (void)storeData:(NSData *)data toDiskForKey:(NSString *)key 124 | { 125 | if (data != nil) { 126 | NSString *path = [self cachePathForKey:key]; 127 | [[NSFileManager defaultManager] createFileAtPath:path 128 | contents:data 129 | attributes:nil]; 130 | [data release]; 131 | } 132 | } 133 | 134 | - (NSString *)pathExtensionWithKey:(NSString *)key 135 | { 136 | NSString *pathExt = nil; 137 | NSArray *components = [key componentsSeparatedByString:@"?"]; 138 | if ([components count] > 0) { 139 | pathExt = [[components objectAtIndex:0] pathExtension]; 140 | } 141 | return pathExt; 142 | } 143 | 144 | 145 | #pragma mark - 146 | #pragma mark Public methods 147 | 148 | - (void)storeData:(NSData *)data forKey:(NSString *)key toDisk:(BOOL)toDisk toMemory:(BOOL)toMemory 149 | { 150 | if (nil == data || nil == key) { 151 | return; 152 | } 153 | 154 | if (toMemory) { 155 | [memoryCache_ setObject:data forKey:key]; 156 | } 157 | 158 | if (toDisk) { 159 | [self storeData:data toDiskForKey:key]; 160 | // NSOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self 161 | // selector:@selector(storeKeyToDisk:) 162 | // object:key]; 163 | // [cacheInQueue_ addOperation:operation]; 164 | // [operation release]; 165 | } 166 | } 167 | 168 | 169 | - (NSData *)dataWithKey:(NSString *)key 170 | { 171 | if (nil == key) { 172 | return nil; 173 | } 174 | 175 | NSData *data = [memoryCache_ objectForKey:key]; 176 | if (!data) { 177 | NSString *path = [self cachePathForKey:key]; 178 | data = [NSData dataWithContentsOfFile:path]; 179 | 180 | // Add to the memory cache. 181 | if (data != nil) { 182 | [memoryCache_ setObject:data forKey:key]; 183 | } 184 | } 185 | 186 | return data; 187 | } 188 | 189 | - (NSURL *)fileURLWithKey:(NSString *)key 190 | { 191 | if (nil == key) { 192 | return nil; 193 | } 194 | 195 | NSString *path = [self cachePathForKey:key]; 196 | NSURL *url = nil; 197 | if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { 198 | url = [NSURL fileURLWithPath:path]; 199 | } 200 | return url; 201 | } 202 | 203 | - (void)clearMemory 204 | { 205 | [cacheInQueue_ cancelAllOperations]; 206 | [memoryCache_ removeAllObjects]; 207 | } 208 | 209 | - (void)clearDisk 210 | { 211 | [cacheInQueue_ cancelAllOperations]; 212 | [[NSFileManager defaultManager] removeItemAtPath:diskCachePath_ error:nil]; 213 | [[NSFileManager defaultManager] createDirectoryAtPath:diskCachePath_ withIntermediateDirectories:YES attributes:nil error:NULL]; 214 | } 215 | 216 | - (void)cleanDisk 217 | { 218 | NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-cacheMaxCacheAge]; 219 | NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:diskCachePath_]; 220 | for (NSString *fileName in fileEnumerator) { 221 | NSString *filePath = [diskCachePath_ stringByAppendingPathComponent:fileName]; 222 | NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil]; 223 | if ([[[attrs fileModificationDate] laterDate:expirationDate] isEqualToDate:expirationDate]) { 224 | [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; 225 | } 226 | } 227 | } 228 | 229 | 230 | #pragma mark - 231 | #pragma mark Singleton Class Code 232 | 233 | static KTFileCache *sharedKTFileCache = nil; 234 | 235 | + (KTFileCache *)sharedKTFileCache 236 | { 237 | @synchronized(self) 238 | { 239 | if (sharedKTFileCache == nil) 240 | { 241 | sharedKTFileCache = [[self alloc] init]; 242 | } 243 | } 244 | 245 | return sharedKTFileCache; 246 | } 247 | 248 | + (id)allocWithZone:(NSZone *)zone 249 | { 250 | @synchronized(self) 251 | { 252 | if (sharedKTFileCache == nil) 253 | { 254 | sharedKTFileCache = [super allocWithZone:zone]; 255 | return sharedKTFileCache; 256 | } 257 | } 258 | 259 | return nil; 260 | } 261 | 262 | - (id)copyWithZone:(NSZone *)zone 263 | { 264 | return self; 265 | } 266 | 267 | - (id)retain 268 | { 269 | return self; 270 | } 271 | 272 | - (NSUInteger)retainCount 273 | { 274 | return NSUIntegerMax; 275 | } 276 | 277 | - (void)release 278 | { 279 | } 280 | 281 | - (id)autorelease 282 | { 283 | return self; 284 | } 285 | 286 | @end 287 | -------------------------------------------------------------------------------- /src/Sample/Classes/MyDownloadManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyDownloadManager.h 3 | // Sample 4 | // 5 | // Created by Kirby Turner on 8/2/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KTDownloadManagerDelegate.h" 11 | 12 | @class KTDownloadManager; 13 | @protocol MyDownloadManagerDelegate; 14 | 15 | @interface MyDownloadManager : NSObject { 16 | KTDownloadManager *dm; 17 | id delegate; 18 | } 19 | 20 | @property (nonatomic, retain) id delegate; 21 | 22 | - (void)downloadImageWithURL:(NSURL *)url; 23 | - (void)downloadAudioFileWithURL:(NSURL *)url; 24 | 25 | @end 26 | 27 | 28 | @protocol MyDownloadManagerDelegate 29 | @optional 30 | - (void)myDownloadManagerImage:(UIImage *)image; 31 | - (void)myDownloadManagerAudioFileURL:(NSURL *)url; 32 | - (void)myDownloadManagerDidFailWithError:(NSError *)error; 33 | @end -------------------------------------------------------------------------------- /src/Sample/Classes/MyDownloadManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyDownloadManager.m 3 | // Sample 4 | // 5 | // Created by Kirby Turner on 8/2/10. 6 | // Copyright 2010 White Peak Software Inc. All rights reserved. 7 | // 8 | 9 | #import "MyDownloadManager.h" 10 | #import "KTDownloadManager.h" 11 | 12 | 13 | #define DOWNLOADTYPE_IMAGE 1 14 | #define DOWNLOADTYPE_AUDIO 2 15 | 16 | 17 | @implementation MyDownloadManager 18 | 19 | @synthesize delegate; 20 | 21 | - (void)dealloc 22 | { 23 | [dm release], dm = nil; 24 | 25 | [super dealloc]; 26 | } 27 | 28 | - (id)init 29 | { 30 | self = [super init]; 31 | if (self) { 32 | dm = [[KTDownloadManager alloc] init]; 33 | [dm setDelegate:self]; 34 | } 35 | return self; 36 | } 37 | 38 | - (void)downloadImageWithURL:(NSURL *)url 39 | { 40 | [dm downloadDataWithURL:url tag:DOWNLOADTYPE_IMAGE responseType:KTDownloadManagerResponseTypeData|KTDownloadManagerResponseTypeFileURL]; 41 | } 42 | 43 | - (void)downloadAudioFileWithURL:(NSURL *)url 44 | { 45 | [dm downloadDataWithURL:url tag:DOWNLOADTYPE_AUDIO responseType:KTDownloadManagerResponseTypeFileURL]; 46 | } 47 | 48 | #pragma mark - 49 | #pragma mark KTDownloadManagerDelegate Methods 50 | 51 | - (void)downloadManagerDidFinishWithResponseData:(NSDictionary *)respData tag:(NSInteger)tag 52 | { 53 | if (tag == DOWNLOADTYPE_IMAGE) { 54 | if (delegate && [delegate respondsToSelector:@selector(myDownloadManagerImage:)]) { 55 | NSData *data = [respData objectForKey:ktDownloadManagerResponseKeyData]; 56 | UIImage *image = [UIImage imageWithData:data]; 57 | [delegate myDownloadManagerImage:image]; 58 | } 59 | } else if (tag == DOWNLOADTYPE_AUDIO) { 60 | if (delegate && [delegate respondsToSelector:@selector(myDownloadManagerAudioFileURL:)]) { 61 | NSURL *url = [respData objectForKey:ktDownloadManagerResponseKeyFileURL]; 62 | [delegate myDownloadManagerAudioFileURL:url]; 63 | } 64 | } 65 | } 66 | 67 | - (void)downloadManagerDidFailWithError:(NSError *)error 68 | { 69 | if (delegate && [delegate respondsToSelector:@selector(myDownloadManagerDidFailWithError:)]) { 70 | [delegate myDownloadManagerDidFailWithError:error]; 71 | } 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /src/Sample/Classes/SampleAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SampleAppDelegate.h 3 | // Sample 4 | // 5 | // Created by Kirby Turner on 8/2/10. 6 | // Copyright White Peak Software Inc 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class SampleViewController; 12 | 13 | @interface SampleAppDelegate : NSObject { 14 | UIWindow *window; 15 | SampleViewController *viewController; 16 | } 17 | 18 | @property (nonatomic, retain) IBOutlet UIWindow *window; 19 | @property (nonatomic, retain) IBOutlet SampleViewController *viewController; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /src/Sample/Classes/SampleAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SampleAppDelegate.m 3 | // Sample 4 | // 5 | // Created by Kirby Turner on 8/2/10. 6 | // Copyright White Peak Software Inc 2010. All rights reserved. 7 | // 8 | 9 | #import "SampleAppDelegate.h" 10 | #import "SampleViewController.h" 11 | 12 | @implementation SampleAppDelegate 13 | 14 | @synthesize window; 15 | @synthesize viewController; 16 | 17 | 18 | #pragma mark - 19 | #pragma mark Application lifecycle 20 | 21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 22 | 23 | // Override point for customization after application launch. 24 | 25 | // Add the view controller's view to the window and display. 26 | [window addSubview:viewController.view]; 27 | [window makeKeyAndVisible]; 28 | 29 | return YES; 30 | } 31 | 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application { 34 | /* 35 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 36 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 37 | */ 38 | } 39 | 40 | 41 | - (void)applicationDidEnterBackground:(UIApplication *)application { 42 | /* 43 | Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 44 | If your application supports background execution, called instead of applicationWillTerminate: when the user quits. 45 | */ 46 | } 47 | 48 | 49 | - (void)applicationWillEnterForeground:(UIApplication *)application { 50 | /* 51 | Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. 52 | */ 53 | } 54 | 55 | 56 | - (void)applicationDidBecomeActive:(UIApplication *)application { 57 | /* 58 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 59 | */ 60 | } 61 | 62 | 63 | - (void)applicationWillTerminate:(UIApplication *)application { 64 | /* 65 | Called when the application is about to terminate. 66 | See also applicationDidEnterBackground:. 67 | */ 68 | } 69 | 70 | 71 | #pragma mark - 72 | #pragma mark Memory management 73 | 74 | - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { 75 | /* 76 | Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. 77 | */ 78 | } 79 | 80 | 81 | - (void)dealloc { 82 | [viewController release]; 83 | [window release]; 84 | [super dealloc]; 85 | } 86 | 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /src/Sample/Classes/SampleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SampleViewController.h 3 | // Sample 4 | // 5 | // Created by Kirby Turner on 8/2/10. 6 | // Copyright White Peak Software Inc 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import "MyDownloadManager.h" 13 | 14 | @class KTDownloadManager; 15 | 16 | @interface SampleViewController : UIViewController { 17 | MyDownloadManager *dm; 18 | NSInteger downloadCount; // Used to stop animation for activity indicator. 19 | UIImageView *imageView; 20 | UIActivityIndicatorView *activityIndicator; 21 | } 22 | 23 | @property (nonatomic, retain) IBOutlet UIImageView *imageView; 24 | @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator; 25 | 26 | @end 27 | 28 | -------------------------------------------------------------------------------- /src/Sample/Classes/SampleViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SampleViewController.m 3 | // Sample 4 | // 5 | // Created by Kirby Turner on 8/2/10. 6 | // Copyright White Peak Software Inc 2010. All rights reserved. 7 | // 8 | 9 | #import "SampleViewController.h" 10 | 11 | @implementation SampleViewController 12 | 13 | @synthesize imageView; 14 | @synthesize activityIndicator; 15 | 16 | - (void)dealloc { 17 | [imageView release], imageView = nil; 18 | [activityIndicator release], activityIndicator = nil; 19 | [dm release], dm = nil; 20 | 21 | [super dealloc]; 22 | } 23 | 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | downloadCount = 0; 29 | 30 | dm = [[MyDownloadManager alloc] init]; 31 | [dm setDelegate:self]; 32 | 33 | // Download an image. Cache it in memory and on the file system. 34 | downloadCount += 1; 35 | NSURL *imageURL = [NSURL URLWithString:@"http://farm4.static.flickr.com/3427/3192205971_0f494a3da2_o.jpg"]; 36 | [dm downloadImageWithURL:imageURL]; 37 | 38 | // Download an audio file (.mp3). Since the media player has trouble 39 | // detecting audio file formats from memory buffers, we'll cache the 40 | // audio to the file system only and use the file URL for playback. 41 | downloadCount += 1; 42 | NSURL *audioURL = [NSURL URLWithString:@"http://thecave.com/downloads/control.mp3"]; 43 | [dm downloadAudioFileWithURL:audioURL]; 44 | } 45 | 46 | /* 47 | // Override to allow orientations other than the default portrait orientation. 48 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 49 | // Return YES for supported orientations 50 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 51 | } 52 | */ 53 | 54 | - (void)didReceiveMemoryWarning { 55 | // Releases the view if it doesn't have a superview. 56 | [super didReceiveMemoryWarning]; 57 | 58 | // Release any cached data, images, etc that aren't in use. 59 | } 60 | 61 | - (void)viewDidUnload { 62 | // Release any retained subviews of the main view. 63 | // e.g. self.myOutlet = nil; 64 | 65 | [self setImageView:nil]; 66 | [self setActivityIndicator:nil]; 67 | } 68 | 69 | - (void)playAudioFileAtURL:(NSURL *)fileURL 70 | { 71 | NSError *error = nil; 72 | AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&error]; 73 | 74 | if (error) { 75 | NSLog(@"Audio player error: %@", [error localizedDescription]); 76 | [player release], player = nil; 77 | } else { 78 | [player setDelegate:self]; 79 | [player setMeteringEnabled:NO]; 80 | [player setVolume:1.0]; 81 | [player setNumberOfLoops:0]; 82 | [player play]; 83 | } 84 | } 85 | 86 | - (void)decDownloadCount 87 | { 88 | downloadCount -= 1; 89 | if (downloadCount < 1) { 90 | [activityIndicator stopAnimating]; 91 | downloadCount = 0; 92 | } 93 | } 94 | 95 | 96 | #pragma mark - 97 | #pragma mark MyDownloadManagerDelegate Methods 98 | 99 | - (void)myDownloadManagerImage:(UIImage *)image 100 | { 101 | [imageView setImage:image]; 102 | [self decDownloadCount]; 103 | } 104 | 105 | - (void)myDownloadManagerAudioFileURL:(NSURL *)url 106 | { 107 | [self playAudioFileAtURL:url]; 108 | [self decDownloadCount]; 109 | } 110 | 111 | - (void)myDownloadManagerDidFailWithError:(NSError *)error 112 | { 113 | NSLog(@"Error: %@", [error localizedDescription]); 114 | } 115 | 116 | 117 | #pragma mark - 118 | #pragma mark AVAudioPlayerDelegate Methods 119 | 120 | - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag 121 | { 122 | [player release], player = nil; 123 | } 124 | 125 | /* if an error occurs while decoding it will be reported to the delegate. */ 126 | - (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error 127 | { 128 | [player release], player = nil; 129 | } 130 | 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /src/Sample/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10D571 6 | 786 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 112 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | SampleViewController 45 | 46 | 47 | 1 48 | 49 | IBCocoaTouchFramework 50 | NO 51 | 52 | 53 | 54 | 292 55 | {320, 480} 56 | 57 | 1 58 | MSAxIDEAA 59 | 60 | NO 61 | NO 62 | 63 | IBCocoaTouchFramework 64 | YES 65 | 66 | 67 | 68 | 69 | YES 70 | 71 | 72 | delegate 73 | 74 | 75 | 76 | 4 77 | 78 | 79 | 80 | viewController 81 | 82 | 83 | 84 | 11 85 | 86 | 87 | 88 | window 89 | 90 | 91 | 92 | 14 93 | 94 | 95 | 96 | 97 | YES 98 | 99 | 0 100 | 101 | 102 | 103 | 104 | 105 | -1 106 | 107 | 108 | File's Owner 109 | 110 | 111 | 3 112 | 113 | 114 | Sample App Delegate 115 | 116 | 117 | -2 118 | 119 | 120 | 121 | 122 | 10 123 | 124 | 125 | 126 | 127 | 12 128 | 129 | 130 | 131 | 132 | 133 | 134 | YES 135 | 136 | YES 137 | -1.CustomClassName 138 | -2.CustomClassName 139 | 10.CustomClassName 140 | 10.IBEditorWindowLastContentRect 141 | 10.IBPluginDependency 142 | 12.IBEditorWindowLastContentRect 143 | 12.IBPluginDependency 144 | 3.CustomClassName 145 | 3.IBPluginDependency 146 | 147 | 148 | YES 149 | UIApplication 150 | UIResponder 151 | SampleViewController 152 | {{234, 376}, {320, 480}} 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | {{525, 346}, {320, 480}} 155 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 156 | SampleAppDelegate 157 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 158 | 159 | 160 | 161 | YES 162 | 163 | 164 | YES 165 | 166 | 167 | 168 | 169 | YES 170 | 171 | 172 | YES 173 | 174 | 175 | 176 | 15 177 | 178 | 179 | 180 | YES 181 | 182 | UIWindow 183 | UIView 184 | 185 | IBUserSource 186 | 187 | 188 | 189 | 190 | SampleAppDelegate 191 | NSObject 192 | 193 | YES 194 | 195 | YES 196 | viewController 197 | window 198 | 199 | 200 | YES 201 | SampleViewController 202 | UIWindow 203 | 204 | 205 | 206 | YES 207 | 208 | YES 209 | viewController 210 | window 211 | 212 | 213 | YES 214 | 215 | viewController 216 | SampleViewController 217 | 218 | 219 | window 220 | UIWindow 221 | 222 | 223 | 224 | 225 | IBProjectSource 226 | Classes/SampleAppDelegate.h 227 | 228 | 229 | 230 | SampleAppDelegate 231 | NSObject 232 | 233 | IBUserSource 234 | 235 | 236 | 237 | 238 | SampleViewController 239 | UIViewController 240 | 241 | IBProjectSource 242 | Classes/SampleViewController.h 243 | 244 | 245 | 246 | 247 | YES 248 | 249 | NSObject 250 | 251 | IBFrameworkSource 252 | Foundation.framework/Headers/NSError.h 253 | 254 | 255 | 256 | NSObject 257 | 258 | IBFrameworkSource 259 | Foundation.framework/Headers/NSFileManager.h 260 | 261 | 262 | 263 | NSObject 264 | 265 | IBFrameworkSource 266 | Foundation.framework/Headers/NSKeyValueCoding.h 267 | 268 | 269 | 270 | NSObject 271 | 272 | IBFrameworkSource 273 | Foundation.framework/Headers/NSKeyValueObserving.h 274 | 275 | 276 | 277 | NSObject 278 | 279 | IBFrameworkSource 280 | Foundation.framework/Headers/NSKeyedArchiver.h 281 | 282 | 283 | 284 | NSObject 285 | 286 | IBFrameworkSource 287 | Foundation.framework/Headers/NSObject.h 288 | 289 | 290 | 291 | NSObject 292 | 293 | IBFrameworkSource 294 | Foundation.framework/Headers/NSRunLoop.h 295 | 296 | 297 | 298 | NSObject 299 | 300 | IBFrameworkSource 301 | Foundation.framework/Headers/NSThread.h 302 | 303 | 304 | 305 | NSObject 306 | 307 | IBFrameworkSource 308 | Foundation.framework/Headers/NSURL.h 309 | 310 | 311 | 312 | NSObject 313 | 314 | IBFrameworkSource 315 | Foundation.framework/Headers/NSURLConnection.h 316 | 317 | 318 | 319 | NSObject 320 | 321 | IBFrameworkSource 322 | UIKit.framework/Headers/UIAccessibility.h 323 | 324 | 325 | 326 | NSObject 327 | 328 | IBFrameworkSource 329 | UIKit.framework/Headers/UINibLoading.h 330 | 331 | 332 | 333 | NSObject 334 | 335 | IBFrameworkSource 336 | UIKit.framework/Headers/UIResponder.h 337 | 338 | 339 | 340 | UIApplication 341 | UIResponder 342 | 343 | IBFrameworkSource 344 | UIKit.framework/Headers/UIApplication.h 345 | 346 | 347 | 348 | UIResponder 349 | NSObject 350 | 351 | 352 | 353 | UISearchBar 354 | UIView 355 | 356 | IBFrameworkSource 357 | UIKit.framework/Headers/UISearchBar.h 358 | 359 | 360 | 361 | UISearchDisplayController 362 | NSObject 363 | 364 | IBFrameworkSource 365 | UIKit.framework/Headers/UISearchDisplayController.h 366 | 367 | 368 | 369 | UIView 370 | 371 | IBFrameworkSource 372 | UIKit.framework/Headers/UITextField.h 373 | 374 | 375 | 376 | UIView 377 | UIResponder 378 | 379 | IBFrameworkSource 380 | UIKit.framework/Headers/UIView.h 381 | 382 | 383 | 384 | UIViewController 385 | 386 | IBFrameworkSource 387 | UIKit.framework/Headers/UINavigationController.h 388 | 389 | 390 | 391 | UIViewController 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UIPopoverController.h 395 | 396 | 397 | 398 | UIViewController 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UISplitViewController.h 402 | 403 | 404 | 405 | UIViewController 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UITabBarController.h 409 | 410 | 411 | 412 | UIViewController 413 | UIResponder 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIViewController.h 417 | 418 | 419 | 420 | UIWindow 421 | UIView 422 | 423 | IBFrameworkSource 424 | UIKit.framework/Headers/UIWindow.h 425 | 426 | 427 | 428 | 429 | 0 430 | IBCocoaTouchFramework 431 | 432 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 433 | 434 | 435 | 436 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 437 | 438 | 439 | YES 440 | Sample.xcodeproj 441 | 3 442 | 112 443 | 444 | 445 | -------------------------------------------------------------------------------- /src/Sample/Sample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Sample/Sample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* SampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* SampleAppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 15 | 2899E5220DE3E06400AC0155 /* SampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* SampleViewController.xib */; }; 16 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 17 | 28D7ACF80DDB3853001CB0EB /* SampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* SampleViewController.m */; }; 18 | 6825FD0C1207423200E00F8B /* KTDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 6825FD051207423200E00F8B /* KTDownloader.m */; }; 19 | 6825FD0D1207423200E00F8B /* KTDownloadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6825FD081207423200E00F8B /* KTDownloadManager.m */; }; 20 | 6825FD0E1207423200E00F8B /* KTFileCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 6825FD0B1207423200E00F8B /* KTFileCache.m */; }; 21 | 6825FD4E1207460500E00F8B /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6825FD4D1207460500E00F8B /* AVFoundation.framework */; }; 22 | 6825FEA012079DA500E00F8B /* MyDownloadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6825FE9F12079DA500E00F8B /* MyDownloadManager.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 27 | 1D3623240D0F684500981E51 /* SampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleAppDelegate.h; sourceTree = ""; }; 28 | 1D3623250D0F684500981E51 /* SampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SampleAppDelegate.m; sourceTree = ""; }; 29 | 1D6058910D05DD3D006BFB54 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 31 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 32 | 2899E5210DE3E06400AC0155 /* SampleViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SampleViewController.xib; sourceTree = ""; }; 33 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 34 | 28D7ACF60DDB3853001CB0EB /* SampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleViewController.h; sourceTree = ""; }; 35 | 28D7ACF70DDB3853001CB0EB /* SampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SampleViewController.m; sourceTree = ""; }; 36 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | 32CA4F630368D1EE00C91783 /* Sample_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sample_Prefix.pch; sourceTree = ""; }; 38 | 6825FD041207423200E00F8B /* KTDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTDownloader.h; sourceTree = ""; }; 39 | 6825FD051207423200E00F8B /* KTDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KTDownloader.m; sourceTree = ""; }; 40 | 6825FD061207423200E00F8B /* KTDownloaderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTDownloaderDelegate.h; sourceTree = ""; }; 41 | 6825FD071207423200E00F8B /* KTDownloadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTDownloadManager.h; sourceTree = ""; }; 42 | 6825FD081207423200E00F8B /* KTDownloadManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KTDownloadManager.m; sourceTree = ""; }; 43 | 6825FD091207423200E00F8B /* KTDownloadManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTDownloadManagerDelegate.h; sourceTree = ""; }; 44 | 6825FD0A1207423200E00F8B /* KTFileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTFileCache.h; sourceTree = ""; }; 45 | 6825FD0B1207423200E00F8B /* KTFileCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KTFileCache.m; sourceTree = ""; }; 46 | 6825FD4D1207460500E00F8B /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 47 | 6825FE9E12079DA500E00F8B /* MyDownloadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyDownloadManager.h; sourceTree = ""; }; 48 | 6825FE9F12079DA500E00F8B /* MyDownloadManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDownloadManager.m; sourceTree = ""; }; 49 | 8D1107310486CEB800E47090 /* Sample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Sample-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 58 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 59 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 60 | 6825FD4E1207460500E00F8B /* AVFoundation.framework in Frameworks */, 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | 080E96DDFE201D6D7F000001 /* Classes */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 1D3623240D0F684500981E51 /* SampleAppDelegate.h */, 71 | 1D3623250D0F684500981E51 /* SampleAppDelegate.m */, 72 | 28D7ACF60DDB3853001CB0EB /* SampleViewController.h */, 73 | 28D7ACF70DDB3853001CB0EB /* SampleViewController.m */, 74 | 6825FE9E12079DA500E00F8B /* MyDownloadManager.h */, 75 | 6825FE9F12079DA500E00F8B /* MyDownloadManager.m */, 76 | ); 77 | path = Classes; 78 | sourceTree = ""; 79 | }; 80 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 1D6058910D05DD3D006BFB54 /* Sample.app */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 6825FD031207423200E00F8B /* KTDownloadManager */, 92 | 080E96DDFE201D6D7F000001 /* Classes */, 93 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 94 | 29B97317FDCFA39411CA2CEA /* Resources */, 95 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 96 | 19C28FACFE9D520D11CA2CBB /* Products */, 97 | 6825FD4D1207460500E00F8B /* AVFoundation.framework */, 98 | ); 99 | name = CustomTemplate; 100 | sourceTree = ""; 101 | }; 102 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 32CA4F630368D1EE00C91783 /* Sample_Prefix.pch */, 106 | 29B97316FDCFA39411CA2CEA /* main.m */, 107 | ); 108 | name = "Other Sources"; 109 | sourceTree = ""; 110 | }; 111 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 2899E5210DE3E06400AC0155 /* SampleViewController.xib */, 115 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 116 | 8D1107310486CEB800E47090 /* Sample-Info.plist */, 117 | ); 118 | name = Resources; 119 | sourceTree = ""; 120 | }; 121 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 125 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 126 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 127 | ); 128 | name = Frameworks; 129 | sourceTree = ""; 130 | }; 131 | 6825FD031207423200E00F8B /* KTDownloadManager */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 6825FD041207423200E00F8B /* KTDownloader.h */, 135 | 6825FD051207423200E00F8B /* KTDownloader.m */, 136 | 6825FD061207423200E00F8B /* KTDownloaderDelegate.h */, 137 | 6825FD071207423200E00F8B /* KTDownloadManager.h */, 138 | 6825FD081207423200E00F8B /* KTDownloadManager.m */, 139 | 6825FD091207423200E00F8B /* KTDownloadManagerDelegate.h */, 140 | 6825FD0A1207423200E00F8B /* KTFileCache.h */, 141 | 6825FD0B1207423200E00F8B /* KTFileCache.m */, 142 | ); 143 | name = KTDownloadManager; 144 | path = ../KTDownloadManager; 145 | sourceTree = SOURCE_ROOT; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 1D6058900D05DD3D006BFB54 /* Sample */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Sample" */; 153 | buildPhases = ( 154 | 1D60588D0D05DD3D006BFB54 /* Resources */, 155 | 1D60588E0D05DD3D006BFB54 /* Sources */, 156 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | ); 162 | name = Sample; 163 | productName = Sample; 164 | productReference = 1D6058910D05DD3D006BFB54 /* Sample.app */; 165 | productType = "com.apple.product-type.application"; 166 | }; 167 | /* End PBXNativeTarget section */ 168 | 169 | /* Begin PBXProject section */ 170 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 171 | isa = PBXProject; 172 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Sample" */; 173 | compatibilityVersion = "Xcode 3.1"; 174 | hasScannedForEncodings = 1; 175 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 176 | projectDirPath = ""; 177 | projectRoot = ""; 178 | targets = ( 179 | 1D6058900D05DD3D006BFB54 /* Sample */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 190 | 2899E5220DE3E06400AC0155 /* SampleViewController.xib in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXSourcesBuildPhase section */ 197 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 198 | isa = PBXSourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 202 | 1D3623260D0F684500981E51 /* SampleAppDelegate.m in Sources */, 203 | 28D7ACF80DDB3853001CB0EB /* SampleViewController.m in Sources */, 204 | 6825FD0C1207423200E00F8B /* KTDownloader.m in Sources */, 205 | 6825FD0D1207423200E00F8B /* KTDownloadManager.m in Sources */, 206 | 6825FD0E1207423200E00F8B /* KTFileCache.m in Sources */, 207 | 6825FEA012079DA500E00F8B /* MyDownloadManager.m in Sources */, 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXSourcesBuildPhase section */ 212 | 213 | /* Begin XCBuildConfiguration section */ 214 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 215 | isa = XCBuildConfiguration; 216 | buildSettings = { 217 | ALWAYS_SEARCH_USER_PATHS = NO; 218 | COPY_PHASE_STRIP = NO; 219 | GCC_DYNAMIC_NO_PIC = NO; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 222 | GCC_PREFIX_HEADER = Sample_Prefix.pch; 223 | INFOPLIST_FILE = "Sample-Info.plist"; 224 | PRODUCT_NAME = Sample; 225 | }; 226 | name = Debug; 227 | }; 228 | 1D6058950D05DD3E006BFB54 /* Release */ = { 229 | isa = XCBuildConfiguration; 230 | buildSettings = { 231 | ALWAYS_SEARCH_USER_PATHS = NO; 232 | COPY_PHASE_STRIP = YES; 233 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 234 | GCC_PREFIX_HEADER = Sample_Prefix.pch; 235 | INFOPLIST_FILE = "Sample-Info.plist"; 236 | PRODUCT_NAME = Sample; 237 | VALIDATE_PRODUCT = YES; 238 | }; 239 | name = Release; 240 | }; 241 | C01FCF4F08A954540054247B /* Debug */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 245 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 246 | GCC_C_LANGUAGE_STANDARD = c99; 247 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 248 | GCC_WARN_UNUSED_VARIABLE = YES; 249 | PREBINDING = NO; 250 | SDKROOT = iphoneos4.0; 251 | }; 252 | name = Debug; 253 | }; 254 | C01FCF5008A954540054247B /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 258 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 259 | GCC_C_LANGUAGE_STANDARD = c99; 260 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 263 | PREBINDING = NO; 264 | SDKROOT = iphoneos4.0; 265 | }; 266 | name = Release; 267 | }; 268 | /* End XCBuildConfiguration section */ 269 | 270 | /* Begin XCConfigurationList section */ 271 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Sample" */ = { 272 | isa = XCConfigurationList; 273 | buildConfigurations = ( 274 | 1D6058940D05DD3E006BFB54 /* Debug */, 275 | 1D6058950D05DD3E006BFB54 /* Release */, 276 | ); 277 | defaultConfigurationIsVisible = 0; 278 | defaultConfigurationName = Release; 279 | }; 280 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Sample" */ = { 281 | isa = XCConfigurationList; 282 | buildConfigurations = ( 283 | C01FCF4F08A954540054247B /* Debug */, 284 | C01FCF5008A954540054247B /* Release */, 285 | ); 286 | defaultConfigurationIsVisible = 0; 287 | defaultConfigurationName = Release; 288 | }; 289 | /* End XCConfigurationList section */ 290 | }; 291 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 292 | } 293 | -------------------------------------------------------------------------------- /src/Sample/SampleViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10F569 6 | 788 7 | 1038.29 8 | 461.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 117 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | 44 | YES 45 | 46 | 47 | 274 48 | {320, 460} 49 | 50 | NO 51 | IBCocoaTouchFramework 52 | 53 | 54 | 55 | 292 56 | {{141, 211}, {37, 37}} 57 | 58 | NO 59 | IBCocoaTouchFramework 60 | YES 61 | 0 62 | 63 | 64 | {320, 460} 65 | 66 | 67 | 3 68 | MC43NQA 69 | 70 | 2 71 | 72 | 73 | NO 74 | 75 | IBCocoaTouchFramework 76 | 77 | 78 | 79 | 80 | YES 81 | 82 | 83 | view 84 | 85 | 86 | 87 | 7 88 | 89 | 90 | 91 | imageView 92 | 93 | 94 | 95 | 9 96 | 97 | 98 | 99 | activityIndicator 100 | 101 | 102 | 103 | 11 104 | 105 | 106 | 107 | 108 | YES 109 | 110 | 0 111 | 112 | 113 | 114 | 115 | 116 | -1 117 | 118 | 119 | File's Owner 120 | 121 | 122 | -2 123 | 124 | 125 | 126 | 127 | 6 128 | 129 | 130 | YES 131 | 132 | 133 | 134 | 135 | 136 | 137 | 8 138 | 139 | 140 | 141 | 142 | 10 143 | 144 | 145 | 146 | 147 | 148 | 149 | YES 150 | 151 | YES 152 | -1.CustomClassName 153 | -2.CustomClassName 154 | 10.IBPluginDependency 155 | 6.IBEditorWindowLastContentRect 156 | 6.IBPluginDependency 157 | 8.IBPluginDependency 158 | 159 | 160 | YES 161 | SampleViewController 162 | UIResponder 163 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 164 | {{239, 376}, {320, 480}} 165 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 166 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 167 | 168 | 169 | 170 | YES 171 | 172 | 173 | YES 174 | 175 | 176 | 177 | 178 | YES 179 | 180 | 181 | YES 182 | 183 | 184 | 185 | 11 186 | 187 | 188 | 189 | YES 190 | 191 | SampleViewController 192 | UIViewController 193 | 194 | YES 195 | 196 | YES 197 | activityIndicator 198 | imageView 199 | 200 | 201 | YES 202 | UIActivityIndicatorView 203 | UIImageView 204 | 205 | 206 | 207 | YES 208 | 209 | YES 210 | activityIndicator 211 | imageView 212 | 213 | 214 | YES 215 | 216 | activityIndicator 217 | UIActivityIndicatorView 218 | 219 | 220 | imageView 221 | UIImageView 222 | 223 | 224 | 225 | 226 | IBProjectSource 227 | Classes/SampleViewController.h 228 | 229 | 230 | 231 | 232 | YES 233 | 234 | NSObject 235 | 236 | IBFrameworkSource 237 | Foundation.framework/Headers/NSError.h 238 | 239 | 240 | 241 | NSObject 242 | 243 | IBFrameworkSource 244 | Foundation.framework/Headers/NSFileManager.h 245 | 246 | 247 | 248 | NSObject 249 | 250 | IBFrameworkSource 251 | Foundation.framework/Headers/NSKeyValueCoding.h 252 | 253 | 254 | 255 | NSObject 256 | 257 | IBFrameworkSource 258 | Foundation.framework/Headers/NSKeyValueObserving.h 259 | 260 | 261 | 262 | NSObject 263 | 264 | IBFrameworkSource 265 | Foundation.framework/Headers/NSKeyedArchiver.h 266 | 267 | 268 | 269 | NSObject 270 | 271 | IBFrameworkSource 272 | Foundation.framework/Headers/NSObject.h 273 | 274 | 275 | 276 | NSObject 277 | 278 | IBFrameworkSource 279 | Foundation.framework/Headers/NSRunLoop.h 280 | 281 | 282 | 283 | NSObject 284 | 285 | IBFrameworkSource 286 | Foundation.framework/Headers/NSThread.h 287 | 288 | 289 | 290 | NSObject 291 | 292 | IBFrameworkSource 293 | Foundation.framework/Headers/NSURL.h 294 | 295 | 296 | 297 | NSObject 298 | 299 | IBFrameworkSource 300 | Foundation.framework/Headers/NSURLConnection.h 301 | 302 | 303 | 304 | NSObject 305 | 306 | IBFrameworkSource 307 | UIKit.framework/Headers/UIAccessibility.h 308 | 309 | 310 | 311 | NSObject 312 | 313 | IBFrameworkSource 314 | UIKit.framework/Headers/UINibLoading.h 315 | 316 | 317 | 318 | NSObject 319 | 320 | IBFrameworkSource 321 | UIKit.framework/Headers/UIResponder.h 322 | 323 | 324 | 325 | UIActivityIndicatorView 326 | UIView 327 | 328 | IBFrameworkSource 329 | UIKit.framework/Headers/UIActivityIndicatorView.h 330 | 331 | 332 | 333 | UIImageView 334 | UIView 335 | 336 | IBFrameworkSource 337 | UIKit.framework/Headers/UIImageView.h 338 | 339 | 340 | 341 | UIResponder 342 | NSObject 343 | 344 | 345 | 346 | UISearchBar 347 | UIView 348 | 349 | IBFrameworkSource 350 | UIKit.framework/Headers/UISearchBar.h 351 | 352 | 353 | 354 | UISearchDisplayController 355 | NSObject 356 | 357 | IBFrameworkSource 358 | UIKit.framework/Headers/UISearchDisplayController.h 359 | 360 | 361 | 362 | UIView 363 | 364 | IBFrameworkSource 365 | UIKit.framework/Headers/UITextField.h 366 | 367 | 368 | 369 | UIView 370 | UIResponder 371 | 372 | IBFrameworkSource 373 | UIKit.framework/Headers/UIView.h 374 | 375 | 376 | 377 | UIViewController 378 | 379 | IBFrameworkSource 380 | UIKit.framework/Headers/UINavigationController.h 381 | 382 | 383 | 384 | UIViewController 385 | 386 | IBFrameworkSource 387 | UIKit.framework/Headers/UIPopoverController.h 388 | 389 | 390 | 391 | UIViewController 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UISplitViewController.h 395 | 396 | 397 | 398 | UIViewController 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UITabBarController.h 402 | 403 | 404 | 405 | UIViewController 406 | UIResponder 407 | 408 | IBFrameworkSource 409 | UIKit.framework/Headers/UIViewController.h 410 | 411 | 412 | 413 | 414 | 0 415 | IBCocoaTouchFramework 416 | 417 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 418 | 419 | 420 | 421 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 422 | 423 | 424 | YES 425 | Sample.xcodeproj 426 | 3 427 | 117 428 | 429 | 430 | -------------------------------------------------------------------------------- /src/Sample/Sample_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Sample' target in the 'Sample' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /src/Sample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Sample 4 | // 5 | // Created by Kirby Turner on 8/2/10. 6 | // Copyright White Peak Software Inc 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | --------------------------------------------------------------------------------