티스토리 뷰
나름 프로그래밍?/ Objective-C
4. Building an Application; Model, View, Controller; Nib Files; Controls and Target-Action (January 14, 2010)
-Dong- 2010. 4. 9. 06:18
UIApplicationDelegate
• Xcode project templates have one set up by default
• Object you provide that participates in application lifecycle
• Can implement various methods which UIApplication will call
• Examples:
- (void)applicationDidFinishLaunching:(UIApplication *)application;
- (void)applicationWillTerminate:(UIApplication *)application;
홈 버튼 눌렀을때(어플 종료전에 후다닥 처리해야 될 사항들)
- (void)applicationWillResignActive:(UIApplication *)application;
전화 같은게 와서 어플이 백그라운드로 들어갈때 (멀티 태스킹 되구만..)
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;
커스텀 스키마 등록, 예를들어 http://... 은 웹페이지 열기.
커스텀 스키마를 통해 다른 어플에서 해당 어플을 시작시키기 가능(구글맵이 이렇게 되던데..)
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application;
Model
• Manages the app data and state
• Not concerned with UI or presentation
• Often persists somewhere
• Same model should be reusable, unchanged in different interfaces
어떻게 표현될지를 고려하지 않은 그냥 순수 데이터(파일, DB) 이라고 이해..
View
• Present the Model to the user in an appropriate interface
• Allows user to manipulate data
• Does not store any data
■ (except to cache state)
• Easily reusable & configurable to display different data
사용자에게 보여지는 화면(테이블 뷰는 단지 보여지기만 할뿐 데이터를 가지진 않음, 컨트롤러가 가져오지..)
Controller
• Intermediary between Model & View
• Updates the view when the model changes
• Updates the model when the user manipulates the view
• Typically where the app logic lives.
뷰에 꾸며지기 위해 데이터를 가공해주는 역할
잘 설명해주는 듯 ㅋ
Manual Target-Action
• Same information IB would use
• API and UIControlEvents found in UIControl.h
• UIControlEvents is a bitmask
@interface UIControl
- (void)addTarget:(id)target action:(SEL)action
forControlEvents:(UIControlEvents)controlEvents;
- (void)removeTarget:(id)target action:(SEL)action
forControlEvents:(UIControlEvents)controlEvents;
@end
출저 -
ITunes U : iPhone Application Development (Winter 2010) - Tracks
'나름 프로그래밍? > Objective-C' 카테고리의 다른 글
Objective-C 에서의 Singleton (2) | 2010.04.17 |
---|---|
5. Views, Drawing, and Animation (January 19, 2010) (0) | 2010.04.09 |
3. Custom Classes, Object Lifecycle, Autorelease, Objective-C Properties (January 12, 2010) (0) | 2010.04.08 |
XCode 에서 생긴 My Error Solution (1) | 2010.03.16 |
경고창 띄우기 (0) | 2010.03.02 |