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.