Transcript iPhone_2
iPhone Seminar Ⅱ 2010 . 05 . 07 . 금 정보통신연구소 유승구 연구원 Rev. No. 1.2 Last modified: 2010/05/06 2015-04-12 NOVAPEX Mobile Co., LTD Confidential Revision Info. Date Revision Description 2010/05/06 1.0 기본 안 작성 Confidential Agenda ◈ View 개념과 이해 1. UIView Class 1. UIView Class 2. UIView Hierarchy 2. View controller Class 1. Tab bar controller 2. Navigation controllers 참고 링크 3 Confidential 1. UIView - Class ◈ UIView Class 구조 UIResponder UIView UIControl 데이터 표시 UIButton UILabel UISlider UIImageView UISwitch UIScrollView UITextField UITextView 유저 알림 Etc UIAlertView UIWindow UIActionSheet UITabBar UIProgressView UIToolBar UINavigationBar UIView는 드로잉(Drawing)과 이벤트 처리(Event Handling) 구조를 포함하는 클래스 4 Confidential 1. UIView - Hierarchy ◈ UIView의 구조 UIView : Super View BreakaHolic UIView NSArray : Sub View BreakaHolic UIButton Version 1.0 UITableView UISwitch UILabel UITextView UIImage 5 Confidential 1. UIView - Hierarchy ◈ View의 Layer 구조 배열 보관 입력된 순서대로 Index값이 책정되어 레이어 구성됨 5. Button 4. Button 3. Button 2. Label Breaka Holic 1. View 6 Confidential 1. UIView - Hierarchy ◈ 계층을 다루기 위한 API : 계층 레이어 추가 / 삭제 - (void)addSubview:(UIView *)view; - (void)removeFromSuperview; : Index 를 이용한 계층 다루기 - (void)insertSubview:(UIView *)view atIndex:(int)index; - (void)insertSubview:(UIView *)view belowSubview:(UIView *)view; - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)view; - (void)exchangeSubviewAtIndex:(int)index withSubviewAtIndex:(int)otherIndex; 7 Confidential 1. UIView - Hierarchy ◈ AddSubView, InsertSubview UILabel *viewA = [[UILabel alloc] initWith…]; UILabel *viewB = [[UILabel alloc] initWith…]; UILabel *viewC = [[UILabel alloc] initWith…]; View C [self.view addSubview:viewA]; View A [self.view addSubview:viewB]; View B [self.view addSubview:viewC]; //[self.view bringSubviewToFront:viewA]; //[self.view insertSubview:viewA atIndex:0]; 8 Confidential 2. View Control Class ◈ View Controller의 역할 • View & controller UIView : 화면에서 보는 것들을 구성 UIViewController : UIView의 관리, Model과 View의 동기화(Sync) View Controller Controller View Controller 9 Confidential 2. View Control Class ◈ Controller protocol loadView 뷰가 로딩될 때 viewDidLoad 뷰가 로딩되고 난 직후 viewWillAppear 화면에 나타나기 직전 viewDidAppear 화면에 나타난 후 viewWillDisappear 화면에 사라지기 직전 viewDidDisappear 화면에 숨겨지고 난 후 10 Confidential 2. View Control Class ◈ Control Class 구조 UIViewController UITabBarController UINavigationController UITableViewController ABNewPersonViewController MPMoviePlayerController UINavigationItem UIBarItem UITabBarItem UIBarButtonItem 11 Confidential 2. View Control Class - Tab Bar Controller ◈ Tab Bar Controller 여러 개의 독립적인 뷰 컨트롤러 사이를 이동할 수 있게 해줌 12 Confidential 2. View Control Class - Tab Bar Controller ◈ Tab Bar Controller stack <Tab Bar Controller 스택 구조> Tab Bar Controller • 배열로서 뷰 컨트롤러를 관리 • 각 뷰 마다 독립적으로 관리 가능 View View View Controller Controller Controller 13 Confidential 2. View Control Class - Navigation Controller ◈ Navigation Controller 뷰의 계층적 구조 관리를 위한 Navigation Bar 인터페이스 컨트롤러 제공 Table View를 이용하여 계층 구조화 함 14 Confidential 2. View Control Class - Navigation Controller ◈ Navigation Controller <Navigation Controller 스택 구조> Navigation Controller • 뷰 컨트롤러의 스택을 관리 • 뒤로 이동하는 기능 지원 View Controller • 계층적 구조 표현에 용이 View Controller View Controller View Controller 15 Confidential 마무리 감사합니다. 16 Confidential