Tuesday, September 22, 2009

Fenyes gombok keszitese

Itt van egy cikksorozat Michael Heyecktol arrol, hogyan lehet szep fenyes gombokat kesziteni a szokasos UIButton helyett.

Tuesday, September 15, 2009

Andy Finnell: Don’t lose your keys

Leirja, hogy milyen fontos a private key elmentese es hogyan kell csinalni.

Andy Finnell: [UIImage imageNamed:] is a memory leak

Itt van az egesz, de a lenyeg roviden:

"... the UIImages I had constructed with imageNamed: were failing to be released. I suspected that they were being retained in a global cache. The only problem with this cache is it is never released, ever. Even when my app receives a low memory notification and I free up all the memory I can, the UIImage global cache just sits there clutching it’s unused UIImages to its chest, muttering."
...
"The moral of the story is imageNamed: is only for use with small images that are used constantly throughout the app’s lifetime. Never use imageNamed: if you ever want that memory back."

Monday, September 7, 2009

Core Data save hiba es NSError Array (1560) kiiratasa

NSManagedObject save metodusa hibat adott amibol nem tudtam meg tul sokat (Operation could not be completed. (Cocoa error 1560.)), de a Stackowerflow-n segitettek:

Eloszor is valamelyik mandatory property-nek nem adtam erteket.

Masodszor pedig azt is megtudtam, hogy nem csak egy sima NSError-t kaptam vissza, hamem egy NSError tombot (ezt jelenti az 1560). Rendesen kiiratni meg igy kell.

UIImage betoltese bundle-bol

Idezve a The Geek Blog-ot:

[UIImage imageWithContentsOfFile:

[[NSBundle mainBundle]

pathForResource:@"thefilename"

ofType:@"jpg"]];

Glyphysh - 120 icons for iPhone applications

Itt van. (Creatitve Commons Attribute licencelt)

UIImage trukkok

Eloszor is kellett egy thumbnail-t kesziteni egy jpg-bol amihez innen szedtem az otletet es igy csinaltam meg:

NSData *imageData = [[NSData alloc] initWithContentsOfFile:filePath];

UIImage *img = [[UIImage alloc] initWithData:imageData];


UIGraphicsBeginImageContext(CGSizeMake(75.0,75.0));

[img drawInRect:CGRectMake(0.0, 0.0, 75.0, 75.0)];

UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

NSData *thumbData = UIImageJPEGRepresentation(newImage, 0.5);

[thumbData writeToFile:thumbPath atomically:YES];




Aztan itt vannak meg a kovetkezo dolgok:
  • Combine 2 UIImages
  • Create a UIImage from a part of another UIImage
  • Save UIImage to Photo Album

Thursday, September 3, 2009

UITableViewCell beszurasa UITableView-ba

Igy szurunk be egy cellat a TableView elejere:

[self.tableView insertRowsAtIndexPaths:myObject withRowAnimation:UITableViewRowAnimationFade];


Igy pedig feltekerunk, hogy lassuk az uj cellat:

[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];


Wednesday, September 2, 2009

Locating Directories on the System

Igy kell csinalni.