This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Initialize RestKit | |
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"]; | |
// Enable automatic network activity indicator management | |
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; | |
// Initialize object store | |
#ifdef RESTKIT_GENERATE_SEED_DB | |
NSString *seedDatabaseName = nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Initialize RestKit | |
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"]; | |
// Enable automatic network activity indicator management | |
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; | |
// Initialize object store | |
#ifdef RESTKIT_GENERATE_SEED_DB | |
NSString *seedDatabaseName = nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Initialize RestKit | |
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"]; | |
// Enable automatic network activity indicator management | |
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; | |
// Initialize object store | |
#ifdef RESTKIT_GENERATE_SEED_DB | |
NSString *seedDatabaseName = nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Initialize RestKit | |
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"]; | |
// Enable automatic network activity indicator management | |
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; | |
// Initialize object store | |
#ifdef RESTKIT_GENERATE_SEED_DB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// Initialize RestKit | |
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"]; | |
// Enable automatic network activity indicator management | |
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; | |
// Initialize object store | |
#ifdef RESTKIT_GENERATE_SEED_DB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)scrollViewDidScroll:(UIScrollView *)scrollView | |
{ | |
// get the table and search bar bounds | |
CGRect tableBounds = self.tableView.bounds; | |
CGRect searchBarFrame = self.searchBar.frame; | |
// make sure the search bar stays at the table's original x and y as the content moves | |
self.searchBar.frame = CGRectMake(tableBounds.origin.x, | |
tableBounds.origin.y, | |
searchBarFrame.size.width, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface DrugSearchViewController() <UITableViewDelegate, UISearchBarDelegate, UIScrollViewDelegate> | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSError *error = nil; | |
NSURL *storeURL = [NSURLfileURLWithPath:storePath]; | |
__persistentStoreCoordinator = [[NSPersistentStoreCoordinatoralloc] initWithManagedObjectModel:[selfmanagedObjectModel]]; | |
if (![__persistentStoreCoordinatoraddPersistentStoreWithType:NSSQLiteStoreTypeconfiguration:nilURL:storeURL options:nilerror:&error]) { | |
NSLog(@"Unresolved error %@, %@", error, [error userInfo]); | |
abort(); | |
} | |
NSLog(@"Final Store path is: %@", [storeURL path]); | |
return__persistentStoreCoordinator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSError *error = nil; | |
NSURL *storeURL = [NSURLfileURLWithPath:storePath]; | |
__persistentStoreCoordinator = [[NSPersistentStoreCoordinatoralloc] initWithManagedObjectModel:[selfmanagedObjectModel]]; | |
if (![__persistentStoreCoordinatoraddPersistentStoreWithType:NSSQLiteStoreTypeconfiguration:nilURL:storeURL options:nilerror:&error]) { | |
NSLog(@"Unresolved error %@, %@", error, [error userInfo]); | |
abort(); | |
} | |
NSLog(@"Final Store path is: %@", [storeURL path]); | |
return__persistentStoreCoordinator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *storePath = [[[selfapplicationDocumentsDirectory] URLByAppendingPathComponent: @"CoreDataStore.sqlite"] path]; | |
// Check if the store exists in. | |
if (![[NSFileManagerdefaultManager] fileExistsAtPath:storePath]) { | |
// copy the payload to the store location. | |
NSString *bundlePath = [[NSBundlemainBundle] bundlePath]; | |
NSString *bundleStore = [bundlePath stringByAppendingPathComponent:@"persistentStore"]; | |
NSError *error = nil; | |
[[NSFileManagerdefaultManager] copyItemAtPath:bundleStore toPath:storePath error:&error]; |