본문 바로가기

PDA&Mobile

아이폰 앱 개발 팁(5) : Stanford Lecture #6

* 본 포스트는 Blog.MissFlash.com에서 작성한 것으로, 원문 저작자의 동의없이 마음대로 퍼가실 수 없습니다. 포스트의 내용이 마음에 드시면 링크를 이용해주시면 감사하겠습니다.

> Stanford Lecture #6

* Creating a view in Code
- (void)loadView{
MyView *myView = [[MyView alloc] initWithFrame:frame];
self.view = myView;
[myView release];
}

* View controller lifecycle
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)bundle { }
- (void)viewDidLoad {}
- (void)viewWillAppear:(BOOL)animated {}
- (void)viewWillDisappear:(BOOL)animated {}

* Loading & Saving data
NSUserDefaults
Property lists
SQLite
Web services

* Supporting interface rotation
- (void)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
// This view controller only supports portrait.

// retrun (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
// This view controller supports all orientations except for upside-down.
}

* Autoresizing your views
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;