SlideShare a Scribd company logo
iOSiOS 개발개발
2016.06.28
모정훈
목차
- Auto Layout 복습
- 샘플 앱 소개와 관련 학습 내용
- Table View Controller
- Tab Bar View Controller
- Navigation Controller
- To-Do App 제작 ( 실습 )
- Tabbar, Navigation Controller, List, Simple animation
- Catalog App 제작 ( 실습 )
- Load from plist, Tabbar, Navigation Controller, List, Detail
To-Do App
0 To-Do App
- Tabbar, Navigation Controller, List, Simple animation
Catalog App
0 Catalog App
- Load from plist, Tabbar, Navigation Controller, List, Detail
Auto Layout
0 Example
Sample Source #1
0 01.AppLifeCycle
- AppLifeCycleObjectiveC (Objective-C 작성 )
- AppLifeCycleSwift (Swift 작성 )
0 02.HelloWorlds
- HelloWorldObjectiveC (Objective-C 작성 )
- HelloWorldSwift (Swift 작성 )
0 03.StoryBoards
- StoryBoardSwift01 (Segue 의 3 가지 방식 샘플 )
- StoryBoardSwift02 ( 다른 Storyboard 파일의 ViewController 로드 )
0 04.AutoLayout
- AutoLayoutSwift
0 05.XIBvsNoneXIB
- NoneIBTabbar (XIB 없이 코드로 Tabbar 작성 )
- StoryBoardTabbar (IB/StoryBoard 로 Tabbar 작성 )
Sample Source #2
0 01.TestTableViewSwift
- TableView, Delegate/DataSource 이해
- https://github.com/picomax/TableViewSwift
0 02.TodoMemoSwift
- 데이터 저장 (UserDefaults), 화면전환 이해
- https://github.com/picomax/TodoMemo
0 03.CatalogSwift
- Tabbar Controller, Key/Value 코딩의 이해
- https://github.com/picomax/Catalog
View Controller
0 Controller (vs. View)
- public func viewWillAppear (animated: Bool)
- public func viewDidAppear (animated: Bool)
- public func viewWillDisappear (animated: Bool)
- public func viewDidDisappear (animated: Bool)
- public func viewWillLayoutSubviews ()
- public func viewDidLayoutSubviews ()
.
.
.
Class Hierarchy
0 Hierarchy
- NSObject
View Hierarchy
0 UIWindow
0 UIViewController
0 UIView
Table View
0 Table View
Table View Cell
0 Table View Cell
Table View Controller
0 DataSource 주요 함수 및 실행 순서
- numberOfSectionInTableView:
- tableView:numberOfRowsInSection:
- tableView:cellForRowAtIndexPath:
Table View Controller
0 DataSource
Table View Controller
0 Delegate
- 객체의 불필요한 상속을 피하고 ,
- 메소드를 재정의 하지 않음으로써 좀 더 객체 지향적인 ..
Table View Controller
0 Drag
- editingStyleForRowAtIndexPath
- canEditRowAtIndexPath
0 Delete
- commitEditingStyle
Table View Controller
0 UITableViewDataSource
- Required
tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
- Optional
numberOfSectionsInTableView(tableView: UITableView) -> Int
tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String?
tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String?
// Editing
tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool
// Moving/reordering
tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool
// Index
sectionIndexTitlesForTableView(tableView: UITableView) -> [String]?
tableView(tableView: UITableView, sectionForSectionIndexTitle title: String, atIndex index: Int) -> Int
// Data manipulation - insert and delete support
tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath)
// Data manipulation - reorder / moving support
tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)
Table View Controller
0 UITableViewDelegate
- Optional
// Display customization
tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath)
...
// Variable height support
tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
...
// Selection
tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
...
// Editing
tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle
...
tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String?
.
.
.
Example App #1
0 Project 생성
0 TableView 생성 -> Delegate, DataSource 연결
0 TableView -> TableViewCell 생성 (title, subtitle 추가 )
0 ViewController -> Delegate, DataSource 코드 작성
- tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
- tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
0 Data 생성 , DataSource 연결
var items: [String] = ["Egg Benedict", "Mushroom Risotto”, "Full Breakfast", "Hamburger",
"Ham and Egg Sandwich", "Creme Brelee", "White Chocolate Donut", "Starbucks Coffee",
"Vegetable Curry", "Instant Noodle with Egg”, "Noodle with BBQ Pork",
"Japanese Noodle with Pork”, "Green Tea", "Thai Shrimp Cake", "Angry Birds Cake",
"Ham and Cheese Panini"]
Navigation Controller
0 Navigation Bar
0 Custom content
0 Navigation Toolbar
Navigation Controller
0 UINavigationController
0 presentedViewController
0 pushViewController
Navigation Controller
0 Navigation Controller
0 RootViewController
0 Navigation Bar
0 Bar Button Item
0 Navigation Toolbar
Navigation Controller
0 pushViewController
0 popViewController
To-Do App
0 To-Do App
- Tabbar, Navigation Controller, List, Simple animation
To-Do App #1
0 TaskModel
- title: String
- memo: String
- done: String
0 TaskListManager (singleton)
- taskModelArray
- saveAll()
- loadAll() or modelAtIndex(i)
0 ListViewController
- taskListManager.taskModelArray 출력
- textLabel, detailTextLabel, accessoryType
- delete, move item.
0 EditViewController
- taskModel 생성
- taskListManager.taskModelArray.append(model)
To-Do App #2
0 Singleton Pattern
- 하나의 인스턴스
- 어디서든 접근 가능
- 리스트 자체를 관리 (get/set for key from list)
0 UserDefaults
- Library/Preferences/{appID}.plist
- NSData, NSString, NSNumber, NSDate, NSArray, NSDictionary
- or Serialization (NSKeyedArchiver/NSKeyedUnarchiver)
0 Serialization
- flatMap
0 dequeueReusableCellWithIdentifier
- TableViewCell 재사용
To-Do App #3
0 Project 생성
0 Storyboard -> NavigationController 추가
- 기본 TableViewController 를 ViewController 로 교체
- RootViewController 지정
- NavigationBar -> Bar Button Item (Left / Right) 추가
- Left Bar Button Item -> Edit 속성 변경
- Right Bar Button Item -> Add 속성 변경
0 TableView 생성
- delegate, dataSource 연결
- Table View -> Table View Cell 생성 (title, subtitle 추가 )
0 View Controller -> Delegate, DataSource 코드 작성
- taskManager.loadAll()
- taskManager.taskModelArray 연동
To-Do App #4
0 EditViewController 생성
- Navigation Item 생성
- Navigation Item -> Bar Button Item 추가
- Right Bar Button Item -> Done 속성 변경
- Done 버튼 -> 함수 연결
0 EditViewController -> TextField (title/subtitle) 추가
- Done 함수와 title/subtitle 필드 연동
- TaskModel 생성 후 TaskManager.append()
Catalog App
0 Catalog App
- Load from plist, Tabbar, Navigation Controller, List, Detail
Catalog App #1
0 Image Resource, Plist Data
- 리소스 파일 다운로드
- https://db.tt/ssZptzKv
0 CatalogInfo.plist
- Dictionary 타입의 데이터 파일
- 프로젝트 디렉토리에 복사 후 Drag & Drop
0 images
- 이미지 리소스 폴더
- 프로젝트 내 Assets.xcassets 내부로 Drag & Drop
Catalog App #2
0 CatalogModel
- title: String, subtitle, desc, homepage, …
0 CatalogListManager (singleton)
- catalogModelArray
- catalogModelAtIndex(i)
0 CatalogListViewController
- taskListManager.taskModelArray 출력
- textLabel, detailTextLabel, accessoryType
- delete, move item.
0 DetailViewController
0 IntroViewViewController
- taskModel 생성
- taskListManager.taskModelArray.append(model)
Catalog App #3
0 Plist 로드
- let path = NSBundle.mainBundle().pathForResource("CatalogInfo", ofType: "plist")!
- self.infoArray = NSArray(contentsOfFile: path)!
0 Key/Value Coding.
- NSObject.valueForKey(key)
- NSObject.setValue(value, forKey:key)
- NSObject.setValue(value, forKeyPath:classPath)
- dictionary = from.dictionaryWithValuesForKeys(keys:[“a”, “b”, “c”, …])
0 Block coding in swift vs ObjectiveC
{ (parameters) -> return type in
statements
}
0 scrollView.contentSize
- height = CGRectGetMakeY( lastObject.frame )
Catalog App #4
0 Project 생성
- 기존 ViewController 제거
0 Tab Bar Controller 추가
- Tab 이름 / 아이콘 설정
0 Intro Tab Bar
- Intro -> Scroll View 추가
- IntroViewController.swift 생성 / Scene 연결
- Scroll View -> intro image 적용
0 AppInfo Tab Bar
- AppInfo -> Image View 추가
- Appinfo image 적용
Catalog App #5
0 Navigation Controller 추가
- 기존 연결된 TableViewController 제거
- Tab Bar Controller 연결
- Tab 이름 / 아이콘 설정
0 View Controller 생성
- Navigation Controller 의 rootViewController 연결
- CatalogListViewController.swift 생성 후 연결
0 TableView 생성
- delegate, dataSource 연결
- Table View -> Table View Cell 생성 (image:120x85, label, tag 추가 )
- catalogListManager 와 dataSource delegate 연결 코드 작성
- Table View Cell 높이 설정 height : 85
Catalog App #6
0 View Controller 생성
- image(4:3), thumbnail, label, score 컴포넌트 생성
- DetailViewController.swift 생성 후 연결
- CatalogModel 연동 코드 작성
0 prepareForSegue 연결
- CatalogListViewController 과 DetailViewController 연결 코드 작성
- CatalogModel 데이터 전달
Test Code
0 XCTestCase 객체를 상속하여 File 생성
- CatalogTests : XCTestCase {}
- 테스트할 대상과 유사한 파일 명으로 생성후 값 / 함수 테스트
0 Target 지정
- 테스트 시 사용할 객체를 지정
- Singleton 객체의 경우 테스트 전 로드
0 테스트 전 , 후 수행할 코드 작성
- setUp()
- tearDown()
0 테스트 함수 작성
- test + 테스트 명 ()
Q & A
0 Thank You
Thank you
# Contact
- www.picomax.net
- @picomax
- picomax@sk.com

More Related Content

Similar to iOS 앱 개발 강의 자료 #2

[1A5]효율적인안드로이드앱개발
[1A5]효율적인안드로이드앱개발[1A5]효율적인안드로이드앱개발
[1A5]효율적인안드로이드앱개발
NAVER D2
 
자바스크립트 프레임워크 살펴보기
자바스크립트 프레임워크 살펴보기자바스크립트 프레임워크 살펴보기
자바스크립트 프레임워크 살펴보기
Jeado Ko
 
MVP 패턴 소개
MVP 패턴 소개MVP 패턴 소개
MVP 패턴 소개
beom kyun choi
 
[115] clean fe development_윤지수
[115] clean fe development_윤지수[115] clean fe development_윤지수
[115] clean fe development_윤지수
NAVER D2
 
Mongo db 최범균
Mongo db 최범균Mongo db 최범균
Mongo db 최범균
beom kyun choi
 
04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)
Hankyo
 
Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018
Kenneth Ceyer
 
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
흥배 최
 
자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러
자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러
자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러
탑크리에듀(구로디지털단지역3번출구 2분거리)
 
배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlow배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlow
Jang Hoon
 
Clean Front-End Development
Clean Front-End DevelopmentClean Front-End Development
Clean Front-End Development
지수 윤
 
Coded ui가이드
Coded ui가이드Coded ui가이드
Coded ui가이드
SangIn Choung
 
Android ndk jni 설치및 연동
Android ndk jni 설치및 연동Android ndk jni 설치및 연동
Android ndk jni 설치및 연동
Sangon Lee
 
Django를 Django답게, Django로 뉴스 사이트 만들기
Django를 Django답게, Django로 뉴스 사이트 만들기Django를 Django답게, Django로 뉴스 사이트 만들기
Django를 Django답게, Django로 뉴스 사이트 만들기
Kyoung Up Jung
 
막하는 스터디 네 번째 만남 AngularJs (20151108)
막하는 스터디 네 번째 만남 AngularJs (20151108)막하는 스터디 네 번째 만남 AngularJs (20151108)
막하는 스터디 네 번째 만남 AngularJs (20151108)
연웅 조
 
MVVM Pattern for Android
MVVM Pattern for AndroidMVVM Pattern for Android
MVVM Pattern for Android
taeinkim6
 
Nodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjsNodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjs
기동 이
 
Naver api for android
Naver api for androidNaver api for android
Naver api for androidSangon Lee
 
Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기
Jiam Seo
 
Vue.js 기초 실습.pptx
Vue.js 기초 실습.pptxVue.js 기초 실습.pptx
Vue.js 기초 실습.pptx
wonyong hwang
 

Similar to iOS 앱 개발 강의 자료 #2 (20)

[1A5]효율적인안드로이드앱개발
[1A5]효율적인안드로이드앱개발[1A5]효율적인안드로이드앱개발
[1A5]효율적인안드로이드앱개발
 
자바스크립트 프레임워크 살펴보기
자바스크립트 프레임워크 살펴보기자바스크립트 프레임워크 살펴보기
자바스크립트 프레임워크 살펴보기
 
MVP 패턴 소개
MVP 패턴 소개MVP 패턴 소개
MVP 패턴 소개
 
[115] clean fe development_윤지수
[115] clean fe development_윤지수[115] clean fe development_윤지수
[115] clean fe development_윤지수
 
Mongo db 최범균
Mongo db 최범균Mongo db 최범균
Mongo db 최범균
 
04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)
 
Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018
 
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
 
자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러
자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러
자마린 iOS 멀티화면 컨트롤러_네비게이션 컨트롤러, 루트 뷰 컨트롤러
 
배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlow배워봅시다 머신러닝 with TensorFlow
배워봅시다 머신러닝 with TensorFlow
 
Clean Front-End Development
Clean Front-End DevelopmentClean Front-End Development
Clean Front-End Development
 
Coded ui가이드
Coded ui가이드Coded ui가이드
Coded ui가이드
 
Android ndk jni 설치및 연동
Android ndk jni 설치및 연동Android ndk jni 설치및 연동
Android ndk jni 설치및 연동
 
Django를 Django답게, Django로 뉴스 사이트 만들기
Django를 Django답게, Django로 뉴스 사이트 만들기Django를 Django답게, Django로 뉴스 사이트 만들기
Django를 Django답게, Django로 뉴스 사이트 만들기
 
막하는 스터디 네 번째 만남 AngularJs (20151108)
막하는 스터디 네 번째 만남 AngularJs (20151108)막하는 스터디 네 번째 만남 AngularJs (20151108)
막하는 스터디 네 번째 만남 AngularJs (20151108)
 
MVVM Pattern for Android
MVVM Pattern for AndroidMVVM Pattern for Android
MVVM Pattern for Android
 
Nodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjsNodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjs
 
Naver api for android
Naver api for androidNaver api for android
Naver api for android
 
Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기
 
Vue.js 기초 실습.pptx
Vue.js 기초 실습.pptxVue.js 기초 실습.pptx
Vue.js 기초 실습.pptx
 

iOS 앱 개발 강의 자료 #2

  • 2. 목차 - Auto Layout 복습 - 샘플 앱 소개와 관련 학습 내용 - Table View Controller - Tab Bar View Controller - Navigation Controller - To-Do App 제작 ( 실습 ) - Tabbar, Navigation Controller, List, Simple animation - Catalog App 제작 ( 실습 ) - Load from plist, Tabbar, Navigation Controller, List, Detail
  • 3. To-Do App 0 To-Do App - Tabbar, Navigation Controller, List, Simple animation
  • 4. Catalog App 0 Catalog App - Load from plist, Tabbar, Navigation Controller, List, Detail
  • 6. Sample Source #1 0 01.AppLifeCycle - AppLifeCycleObjectiveC (Objective-C 작성 ) - AppLifeCycleSwift (Swift 작성 ) 0 02.HelloWorlds - HelloWorldObjectiveC (Objective-C 작성 ) - HelloWorldSwift (Swift 작성 ) 0 03.StoryBoards - StoryBoardSwift01 (Segue 의 3 가지 방식 샘플 ) - StoryBoardSwift02 ( 다른 Storyboard 파일의 ViewController 로드 ) 0 04.AutoLayout - AutoLayoutSwift 0 05.XIBvsNoneXIB - NoneIBTabbar (XIB 없이 코드로 Tabbar 작성 ) - StoryBoardTabbar (IB/StoryBoard 로 Tabbar 작성 )
  • 7. Sample Source #2 0 01.TestTableViewSwift - TableView, Delegate/DataSource 이해 - https://github.com/picomax/TableViewSwift 0 02.TodoMemoSwift - 데이터 저장 (UserDefaults), 화면전환 이해 - https://github.com/picomax/TodoMemo 0 03.CatalogSwift - Tabbar Controller, Key/Value 코딩의 이해 - https://github.com/picomax/Catalog
  • 8. View Controller 0 Controller (vs. View) - public func viewWillAppear (animated: Bool) - public func viewDidAppear (animated: Bool) - public func viewWillDisappear (animated: Bool) - public func viewDidDisappear (animated: Bool) - public func viewWillLayoutSubviews () - public func viewDidLayoutSubviews () . . .
  • 10. View Hierarchy 0 UIWindow 0 UIViewController 0 UIView
  • 12. Table View Cell 0 Table View Cell
  • 13. Table View Controller 0 DataSource 주요 함수 및 실행 순서 - numberOfSectionInTableView: - tableView:numberOfRowsInSection: - tableView:cellForRowAtIndexPath:
  • 15. Table View Controller 0 Delegate - 객체의 불필요한 상속을 피하고 , - 메소드를 재정의 하지 않음으로써 좀 더 객체 지향적인 ..
  • 16. Table View Controller 0 Drag - editingStyleForRowAtIndexPath - canEditRowAtIndexPath 0 Delete - commitEditingStyle
  • 17. Table View Controller 0 UITableViewDataSource - Required tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell - Optional numberOfSectionsInTableView(tableView: UITableView) -> Int tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? // Editing tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool // Moving/reordering tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool // Index sectionIndexTitlesForTableView(tableView: UITableView) -> [String]? tableView(tableView: UITableView, sectionForSectionIndexTitle title: String, atIndex index: Int) -> Int // Data manipulation - insert and delete support tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) // Data manipulation - reorder / moving support tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath)
  • 18. Table View Controller 0 UITableViewDelegate - Optional // Display customization tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) ... // Variable height support tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat ... // Selection tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) ... // Editing tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle ... tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? . . .
  • 19. Example App #1 0 Project 생성 0 TableView 생성 -> Delegate, DataSource 연결 0 TableView -> TableViewCell 생성 (title, subtitle 추가 ) 0 ViewController -> Delegate, DataSource 코드 작성 - tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int - tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell 0 Data 생성 , DataSource 연결 var items: [String] = ["Egg Benedict", "Mushroom Risotto”, "Full Breakfast", "Hamburger", "Ham and Egg Sandwich", "Creme Brelee", "White Chocolate Donut", "Starbucks Coffee", "Vegetable Curry", "Instant Noodle with Egg”, "Noodle with BBQ Pork", "Japanese Noodle with Pork”, "Green Tea", "Thai Shrimp Cake", "Angry Birds Cake", "Ham and Cheese Panini"]
  • 20. Navigation Controller 0 Navigation Bar 0 Custom content 0 Navigation Toolbar
  • 21. Navigation Controller 0 UINavigationController 0 presentedViewController 0 pushViewController
  • 22. Navigation Controller 0 Navigation Controller 0 RootViewController 0 Navigation Bar 0 Bar Button Item 0 Navigation Toolbar
  • 24. To-Do App 0 To-Do App - Tabbar, Navigation Controller, List, Simple animation
  • 25. To-Do App #1 0 TaskModel - title: String - memo: String - done: String 0 TaskListManager (singleton) - taskModelArray - saveAll() - loadAll() or modelAtIndex(i) 0 ListViewController - taskListManager.taskModelArray 출력 - textLabel, detailTextLabel, accessoryType - delete, move item. 0 EditViewController - taskModel 생성 - taskListManager.taskModelArray.append(model)
  • 26. To-Do App #2 0 Singleton Pattern - 하나의 인스턴스 - 어디서든 접근 가능 - 리스트 자체를 관리 (get/set for key from list) 0 UserDefaults - Library/Preferences/{appID}.plist - NSData, NSString, NSNumber, NSDate, NSArray, NSDictionary - or Serialization (NSKeyedArchiver/NSKeyedUnarchiver) 0 Serialization - flatMap 0 dequeueReusableCellWithIdentifier - TableViewCell 재사용
  • 27. To-Do App #3 0 Project 생성 0 Storyboard -> NavigationController 추가 - 기본 TableViewController 를 ViewController 로 교체 - RootViewController 지정 - NavigationBar -> Bar Button Item (Left / Right) 추가 - Left Bar Button Item -> Edit 속성 변경 - Right Bar Button Item -> Add 속성 변경 0 TableView 생성 - delegate, dataSource 연결 - Table View -> Table View Cell 생성 (title, subtitle 추가 ) 0 View Controller -> Delegate, DataSource 코드 작성 - taskManager.loadAll() - taskManager.taskModelArray 연동
  • 28. To-Do App #4 0 EditViewController 생성 - Navigation Item 생성 - Navigation Item -> Bar Button Item 추가 - Right Bar Button Item -> Done 속성 변경 - Done 버튼 -> 함수 연결 0 EditViewController -> TextField (title/subtitle) 추가 - Done 함수와 title/subtitle 필드 연동 - TaskModel 생성 후 TaskManager.append()
  • 29. Catalog App 0 Catalog App - Load from plist, Tabbar, Navigation Controller, List, Detail
  • 30. Catalog App #1 0 Image Resource, Plist Data - 리소스 파일 다운로드 - https://db.tt/ssZptzKv 0 CatalogInfo.plist - Dictionary 타입의 데이터 파일 - 프로젝트 디렉토리에 복사 후 Drag & Drop 0 images - 이미지 리소스 폴더 - 프로젝트 내 Assets.xcassets 내부로 Drag & Drop
  • 31. Catalog App #2 0 CatalogModel - title: String, subtitle, desc, homepage, … 0 CatalogListManager (singleton) - catalogModelArray - catalogModelAtIndex(i) 0 CatalogListViewController - taskListManager.taskModelArray 출력 - textLabel, detailTextLabel, accessoryType - delete, move item. 0 DetailViewController 0 IntroViewViewController - taskModel 생성 - taskListManager.taskModelArray.append(model)
  • 32. Catalog App #3 0 Plist 로드 - let path = NSBundle.mainBundle().pathForResource("CatalogInfo", ofType: "plist")! - self.infoArray = NSArray(contentsOfFile: path)! 0 Key/Value Coding. - NSObject.valueForKey(key) - NSObject.setValue(value, forKey:key) - NSObject.setValue(value, forKeyPath:classPath) - dictionary = from.dictionaryWithValuesForKeys(keys:[“a”, “b”, “c”, …]) 0 Block coding in swift vs ObjectiveC { (parameters) -> return type in statements } 0 scrollView.contentSize - height = CGRectGetMakeY( lastObject.frame )
  • 33. Catalog App #4 0 Project 생성 - 기존 ViewController 제거 0 Tab Bar Controller 추가 - Tab 이름 / 아이콘 설정 0 Intro Tab Bar - Intro -> Scroll View 추가 - IntroViewController.swift 생성 / Scene 연결 - Scroll View -> intro image 적용 0 AppInfo Tab Bar - AppInfo -> Image View 추가 - Appinfo image 적용
  • 34. Catalog App #5 0 Navigation Controller 추가 - 기존 연결된 TableViewController 제거 - Tab Bar Controller 연결 - Tab 이름 / 아이콘 설정 0 View Controller 생성 - Navigation Controller 의 rootViewController 연결 - CatalogListViewController.swift 생성 후 연결 0 TableView 생성 - delegate, dataSource 연결 - Table View -> Table View Cell 생성 (image:120x85, label, tag 추가 ) - catalogListManager 와 dataSource delegate 연결 코드 작성 - Table View Cell 높이 설정 height : 85
  • 35. Catalog App #6 0 View Controller 생성 - image(4:3), thumbnail, label, score 컴포넌트 생성 - DetailViewController.swift 생성 후 연결 - CatalogModel 연동 코드 작성 0 prepareForSegue 연결 - CatalogListViewController 과 DetailViewController 연결 코드 작성 - CatalogModel 데이터 전달
  • 36. Test Code 0 XCTestCase 객체를 상속하여 File 생성 - CatalogTests : XCTestCase {} - 테스트할 대상과 유사한 파일 명으로 생성후 값 / 함수 테스트 0 Target 지정 - 테스트 시 사용할 객체를 지정 - Singleton 객체의 경우 테스트 전 로드 0 테스트 전 , 후 수행할 코드 작성 - setUp() - tearDown() 0 테스트 함수 작성 - test + 테스트 명 ()
  • 37. Q & A 0 Thank You
  • 38. Thank you # Contact - www.picomax.net - @picomax - picomax@sk.com