lunes, 26 de marzo de 2012

Cambiar nombre de la aplicación

Para cambiar el nombre de la aplicación  hay que seleccionar el proyecto luego hacer doble click en Target y cambiamos el nombre. Luego en la pestaña Build Settings bajo el header Packaging cambiamos el nombre donde dice Product name, vamos al menú Product > Clean y luego Build.

jueves, 8 de marzo de 2012

Método para calcular los días, horas, minutos y segundos que faltan entre la fecha actual y otra futura


- (void) tiempoHasta:(NSString *) hasta {
    
    // Fecha actual
    NSDate *date = [NSDate date];
    int secondsNow =(int)[date timeIntervalSince1970];
   
    // Convierto el string hasta 
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"yyyyMMdd"];
    NSDate *hastaDate = [dateFormat dateFromString:hasta]; 
    
    int secondsTarget=(int)[hastaDate timeIntervalSince1970];
    int differenceSeconds=secondsTarget-secondsNow;
    int days=(int)((double)differenceSeconds/(3600.0*24.00));
    int diffDay=differenceSeconds-(days*3600*24);
    int hours=(int)((double)diffDay/3600.00);
    int diffMin=diffDay-(hours*3600);
    int minutes=(int)(diffMin/60.0);
    int seconds=diffMin-(minutes*60);
}