Thursday, October 29, 2009

Cell Styles

Ilyenek vannak:

UITableViewCellStyleDefault

A simple style for a cell with a text label (black and left-aligned) and an optional image view. Note that this is the default style for cells prior to iPhone OS 3.0.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

UITableViewCellStyleValue1

A style for a cell with a label on the left side of the cell with left-aligned and black text; on the right side is a label that has smaller blue text and is right-aligned. The Settings application uses cells in this style.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

UITableViewCellStyleValue2

A style for a cell with a label on the left side of the cell with text that is right-aligned and blue; on the right side of the cell is another label with smaller text that is left-aligned and black. The Phone/Contacts application uses cells in this style.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

UITableViewCellStyleSubtitle

A style for a cell with a left-aligned label across the top and a left-aligned label below it in smaller gray text. The iPod application uses cells in this style.

Available in iPhone OS 3.0 and later.

Declared in UITableViewCell.h.

Discussion

In all these cell styles, the larger of the text labels is accessed via the textLabel property and the smaller via the detailTextLabel property.

App Version

NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

Thursday, October 15, 2009

SubString keresese NSString-ben

Mondjuk a @-ot igy talaljuk meg egy email cimben:

NSString *s = @"jdoe@example.com";

NSRange range = [s rangeOfString:@"@"];

Az NSRange-nek van egy location-je es egy length-je.
Ha a location NSNotFound, akkor egyet sem talalt:
If (NSNotFound == range.location) {...}
Ha pedig megtalalta, akkor akkor a location a kereset substring elso karakterenek pozicioja a string-ben.

Monday, October 12, 2009

Honnan lehet tudni, hogy Simulator-ban fut-e az app

Valasz a stackoverflow-rol:

It's in the SDK docs under "Compiling source code conditionally"

The relevant definitions are TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR, which will be defined provided that you

#include "TargetConditionals.h"

Since that won't exist on non apple platforms, you can wrap your include like this

#ifdef __APPLE__
#include "TargetConditionals.h"
#endif

before including that file

So, for example, if you want to check that you are running on device, you should do

#if !(TARGET_IPHONE_SIMULATOR)

Itt is felmerult ugyanez a kerdes. Es itt van az iPhone Reference Library-ban.

Thursday, October 8, 2009

GUID generalasa iPhone-on

Felmerult ez a kerdes a stackoverflow-n is, ahol a CFUUID object-et ajanlottak illetve ezt a kodreszletet:

+ (NSString *)GetUUID
{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
return [(NSString *)string autorelease];
}

Friday, October 2, 2009

Fast Enumeration

Itt azt irjak, hogy a Fast Enumeration gyorsabb es tomorebb mint az NSEnumerator.

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.

Saturday, August 29, 2009

UIActivityIndicatorView

Igy hivjak a forgo kis kurzort es itt van rola a leiras.

Fontos, hogy a hidesWhenStopped property default YES, tehat ha nem inditjuk el a porgest a startAnimating-gal es nem allitjuk be a hidesWhenStopped-et NO-ra akkor hiaba pakoljuk ki valahova a View-t, nem fogjuk latni.

Tuesday, August 25, 2009

App Icon keszitese

Itt van egy leiras Dustin Yonak-tol.

Monday, August 24, 2009

Hogyan futtassunk az app-unkat iPhone-on, ha mar megvan a licence

A DevClinic-en szepen leirjak.

Publishing Applications for Testing

Itt minden szepen le van irva.

Kepek leszedese iPhone-rol

Az Image Capture megoldja es van egy Cameras nevu plugin ami megkonnyiti a dolgot:

With familiar System Preference functionality, Cameras allows you to manage what happens when you connect your:

  • Digital camera
  • iPhone
  • Digital media reader
  • Any photo device

In addition to launching a specific application when you connect a camera, you can also have your images download automatically. Never again spend time launching the right app or quitting apps that you didn't want to launch.


Friday, August 14, 2009

Maximum hossz beallitas UITextField-ben es UITextView-ban

Itt van egy leiras, de a lenyeg:
  • A View implementalja aUITextViewDelegate vagy UITextFieldDelegate protokollt.
  • UITextView eseten a textView:shouldChangeTextInRange:replacementText method-ban, UITextField eseten pedig a textField:shouldChangeCharactersInRange:replacementString method-ba kell tenni az ellenorzest
Azt kell megnezni, hogy [[textView text] length] > 0 es
range.length == 0
(range.length 1 lesz, ha torlok egy karaktert)
Illetve UITextField eseten textView helyett textField es range helyett string.

Azt nem tudom, hogy ez mukodik-e igy paste-nel is, mert azt meg nem sikerult kiprobalni a Simulatorban.

Nick Dalton: How To Create A Data Entry Screen

Itt van.

Wednesday, August 12, 2009

thumbnail betoltese UITableViewCell-be

Kell egy custom UITableViewCell aminek van egy UIImageView propertyje
pl.:

IBOutlet UIImageView *image;

...

@property (nonatomic, retain) IBOutlet UIImageView *image;


Es ebbe igy lehet betolteni egy kepet file-bol, ha tudjuk hol van:

NSString *filePath = ...;


[[cell image] setImage:[[UIImage alloc] initWithContentsOfFile:filePath]];


Tuesday, August 11, 2009

Hova teszi a Simulator a kepeket es a thumbnaileket

Ide:
/Users/xxx/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE
A thumbnaileket pedig ide ala a /.MISC-be, de ez finder-ben alapbol nem latszik
Itt van egy csomo THM ami valojaban 75x75 pixeles JPG es BTH ami nem tudom micsoda.

Monday, August 10, 2009

Video lejatszasa iPhone-on

MediaPlayer frameworkkel nagyon egyszer.

nehany cikk a UIImagePickerController-rol

dot notation vagy bracket notation

Itt van a teljes cikk az eschatology-n, de a lenyeg:

  • Hasznaljunk @property deklaraciot az object state-jeinel es ezeket dot notation-nel hivjuk.
  • Hasznaljunk method deklaraciot az object behavior-jainal es ezeket bracket notation-nel hivjuk.

Tuesday, July 21, 2009

Friday, July 17, 2009

Hova ment UIImageWriteToSavedPhotosAlbum Simulator-ban

Hat ide:
yourhome/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE