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
#pragma mark - Transparent Modal View | |
-(void) presentTransparentModalViewController: (UIViewController *) aViewController | |
animated: (BOOL) isAnimated | |
withAlpha: (CGFloat) anAlpha{ | |
self.transparentModalViewController = aViewController; | |
UIView *view = aViewController.view; | |
view.opaque = NO; | |
view.alpha = anAlpha; |
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) addressFromLocation: (CLLocation *) aLocation{ | |
CLGeocoder *geocoder = [[CLGeocoder alloc] init]; | |
self.activity.hidden = NO; | |
[self.activity startAnimating]; | |
self.output.text = @"Ahora lo averiguo. Contactando con Paco Lobatón..."; | |
[geocoder reverseGeocodeLocation:aLocation | |
completionHandler:^(NSArray *placemarks, NSError *error) { |
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 *err = nil; | |
NSURL *aURL = [NSURL URLWithString:@"http://www.google.com"]; | |
NSString *contents = [NSString stringWithContentsOfURL:aURL | |
encoding:NSUTF8StringEncoding | |
error:&err]; |
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 *) fetchStringFrom: (NSURL *) aURL error: (NSError **) err{ | |
// Haz algo raro que pueda cascar | |
if (YES) { | |
// Se ha producido un error | |
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:NSLocalizedDescriptionKey | |
forKey:@"Error al hacer algo arriesgado"]; | |
// recordad que se trata de una doble indirección, así que hay que usar *err | |
*err = [NSError errorWithDomain:@"Mi dominio" |
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 *err = nil; | |
NSURL *aURL = [NSURL URLWithString:@"http://www.google.com"]; | |
NSString *contents = [NSString stringWithContentsOfURL:aURL | |
encoding:NSUTF8StringEncoding | |
error:&err]; | |
// Esto es incorrecto!!!!! | |
if (err) { | |
// Creo que ha habido un error | |
NSLog(@"Creo que ha habido un error:%@", err.localizedDescription); |
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 *err = nil; | |
NSURL *aURL = [NSURL URLWithString:@"http://www.google.com"]; | |
NSString *contents = [NSString stringWithContentsOfURL:aURL | |
encoding:NSUTF8StringEncoding | |
error:&err]; | |
// Esto sí que es correcto: inspeccionar el valor del retorno | |
if (!contents) { | |
// Seguro que ha habido un error | |
NSLog(@"Ahora sí que se ha producido un error:%@", err.localizedDescription); |
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 *err = nil; | |
NSURL *aURL = [NSURL URLWithString:@"http://www.google.com"]; | |
NSString *contents = [NSString stringWithContentsOfURL:aURL | |
encoding:NSUTF8StringEncoding | |
error:&err]; | |
// Esto sí que es correcto: inspeccionar el valor del retorno | |
if (!contents) { | |
// Seguro que ha habido un error | |
NSLog(@"Ahora sí que se ha producido un error:%@", err.localizedDescription); |
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 *err = nil; | |
NSURL *aURL = [NSURL URLWithString:@"http://www.google.com"]; | |
NSString *contents = [NSString stringWithContentsOfURL:aURL | |
encoding:NSUTF8StringEncoding | |
error:&err]; | |
// Esto sí que es correcto: inspeccionar el valor del retorno | |
if (!contents) { | |
// Seguro que ha habido un error | |
NSLog(@"Ahora sí que se ha producido un error:%@", err.localizedDescription); |
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)generateImageOfSize:(CGSize)imageSize | |
{ | |
// Determine integer size of image | |
NSInteger imageIntWidth = ceilf(imageSize.width); | |
NSInteger imageIntHeight = ceilf(imageSize.height); | |
// Determine coordinate maxima | |
assert(zoomFactor > 0.0f); | |
float coordMaxX = coordMinX + imageIntWidth / zoomFactor; | |
float coordMaxY = coordMinY + imageIntHeight / zoomFactor; |
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)generateImageOfSize:(CGSize)imageSize | |
{ | |
// Determine integer size of image | |
NSInteger imageIntWidth = ceilf(imageSize.width); | |
NSInteger imageIntHeight = ceilf(imageSize.height); | |
// Determine coordinate maxima | |
assert(zoomFactor > 0.0f); | |
float coordMaxX = coordMinX + imageIntWidth / zoomFactor; | |
float coordMaxY = coordMinY + imageIntHeight / zoomFactor; |
OlderNewer