'iPhone'에 해당되는 글 5건

  1. 2011.06.22 아이폰앱 아이패드로 변환시 팁
  2. 2010.11.18 UITable row 넣기
  3. 2010.10.27 배경이미지 주기 삽질
  4. 2010.07.02 Xcode의 에디터 사용시 알아두면 편리한 단축키들
  5. 2010.07.02 xcode auto assistant

아이폰앱 아이패드로 변환시 팁

|
info -> Build -> Deployment
Targeted Device Family 속성을 iPhone / iPad로 변경하면 자동으로 기계에 따라 보여준다.

xxx-Info.plist
key value 추가
Main nib file base name (iPad) : MainWindow-iPad (임의로 이름을 준다 기본이 MainWindow이므로, 패드는 -iPad를 붙임)
앱구동시 처음 불러오는 파일로서 폰과 패드용의 xib파일을 분리 할수 있다.

폰/패드 체크
NSString *deviceModel = [[UIDevice currentDevice] model];


 
And

UITable row 넣기

|

[table beginUpdates];

NSIndexPath *indexPath;

for(int i=0; i < [rows count]; i++){

indexPath = [NSIndexPath indexPathForRow:i inSection:0];

[table insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop];

}

[table endUpdates];

[table scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[rows count] inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];



또는


NSMutableArray *rowsToAdd = [[NSMutableArray alloc] init];

for (int i = 0; i < [rows count]; i++) {

[rowsToAdd addObject:[NSIndexPath indexPathForRow:i inSection:0]];

}


[table beginUpdates];

[table insertRowsAtIndexPaths:rowsToAdd withRowAnimation:UITableViewRowAnimationTop];

[table endUpdates];

[table scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[rows count] inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];

And

배경이미지 주기 삽질

|

1.  배경색 주기
    CGContextRef ctx=UIGraphicsGetCurrentContext();
    CGContextSetRGBFillColor(ctx, 05.f, 0.5f, 0.5f, 0.9f);
    CGContextFillRect(ctx, CGRectMake(5, headHeight-28,self.frame.size.width,30 ));

 2. 이미지 백그라운드 패턴식으로 주기
 UIView *mainTitle = [[UIView alloc] initWithFrame:CGRectMake(5, headHeight-28, 320, 30    )];
 mainTitle.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"car_bar.png"]];
 
3. 이미지 주기
    UIImageView *mainTitle = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"car_bar.png"]] autorelease];
    mainTitle.frame = CGRectMake(5, headHeight-28, mainTitle.frame.size.width,mainTitle.frame.size.height);
    [self addSubview:mainTitle];


4. CGContextDrawImage 사용하기
    CGContextRef ctx=UIGraphicsGetCurrentContext();
    UIImage *c = [UIImage imageNamed:@"car_bar.png"];
    CGImageRef cRef = CGImageRetain(c.CGImage);   
    CGContextDrawImage(ctx, CGRectMake(5, headHeight-28,c.size.width, c.size.height+1), cRef);
    [c drawInRect:CGRectMake(5, headHeight-28,c.size.width, c.size.height+1)];
And

Xcode의 에디터 사용시 알아두면 편리한 단축키들

|

Cmd + B : Build
Cmd + R : Bulid & Go
Cmd + Y : Build & Debug

Cmd + Shift + Y : Debugger
Cmd + Shift + R : Console
Cmd + Shift + B : Build Result

Cmd + <- -> : 줄의 맨 앞 또는 뒤로 커서 이동
option + <- -> : 워드 단위의 커서이동
ctrl + <- -> : 워드 내의 대문자 ㄱ ㅣ준 커서 이동
ctrl + / : 매개변수 플레이스 홀더 간 이동(오토 컴플리션 사용시)

Cmd + option + ? : Help 센터 열기
Cmd + option + (화살표위) : 헤더 - 임플리먼트 파일 간 전환
Cmd + 클래스 이름 더블클릭 : 클래스의 헤더 파일로 이동
option + 클래스 이름 더블클릭: Help의 클래스 레퍼런스 페이지로 이동
Cmd + / : 한 줄 주석처리
And

xcode auto assistant

|
http://code.google.com/p/xcode-auto-assistant/


다운후 Developer-Library-Xcode-Plug-ins 안에 넣으믄 끝

And
prev | 1 | next