Professional Documents
Culture Documents
- (void)createEditableCopyOfDatabaseIfNeeded;
PASO 5 : PONER ESTE CODIGO EN EL APPDELEGATE .M.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[self createEditableCopyOfDatabaseIfNeeded];
[window addSubview:tabcontroller.view];
[window makeKeyAndVisible];
}
- (void)createEditableCopyOfDatabaseIfNeeded {
// First, test for existence - we don't want to wipe out a user's DB
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *documentDirectory = [self applicationDocumentsDirectory];
NSString *writableDBPath = [documentDirectory
stringByAppendingPathComponent:@"iBountyHunter.sqlite"];
NSError *error;
BOOL success = [fileManager copyItemAtPath:defaultDBPath
toPath:writableDBPath error:&error];
if (!success) {
NSAssert1(0, @"Failed to create writable database file with message
'%@'.", [error localizedDescription]);
}
}
}
PERSONALIZAR UNA TABLA PARA PRESENTAR DATOS
PASO 1 :
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
PASO 2:
AÑADIR CAMPOS Y CONTROLES PARA HACER
ACCIONES Y COMPORTAMIENTOS
CODIGO PARA DETECTAR CAMBIOS EN LOS DATOS
FILTRAR DATOS EN UNA BASE DE DATOS
PASO 1:
We need to set a predicate on our NSFetchRequest
NSPredicate is a deceptively simple class that lets us express logical constraints on our NSFetchRequest. You use
entity and attribute names along with comparison operators to express your constraint information. You can create a
basic NSPredicate with a string format syntax similar to NSString, like this: