viernes, 21 de septiembre de 2012

hilos objective-c

 [NSThread detachNewThreadSelector:@selector(startTheBackgroundJob) toTarget:self withObject:nil];
Mas información en : http://www.xprogress.com/snippet-10-example-of-threading-in-iphone-sdk-objective-c-using-nsthread/

saber si un hilo es principal
[NSThread isMainThread]

lunes, 10 de septiembre de 2012

UIImage from URL

UIImage * img = [[UIImage alloc] initWithData: 
[NSData dataWithContentsOfURL: 
[NSURL URLWithString:@"http://example.com/image.png"]]];
 
 
Si queremos cargar la imagen de un archivo del proyecto:
 
[UIImage imageWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"thefilename" ofType:@"jpg"]];