[kj-code] 스터디 소개, category

12
Introduce KJ-CODE 2014.02.22 Ji SangHoon in KJ-CODE

Upload: -

Post on 13-Jul-2015

141 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: [KJ-CODE] 스터디 소개, category

Introduce KJ-CODE

2014.02.22 Ji SangHoon in KJ-CODE

Page 2: [KJ-CODE] 스터디 소개, category

KJ-CODE

•Start from 2010. 6

• Start 9 Members

• Study iOS Develop & IT Trend & IT Skills

• We Still Study iOS with 15 Members

• 6 Members are iOS Developer

2010.06.19 2010.10.16 2013.06.29 2013.09.07

Page 3: [KJ-CODE] 스터디 소개, category

iOS DEV 2010 ~

Who Am IGame Dev

Embeded System Dev

Page 4: [KJ-CODE] 스터디 소개, category

Objective-C Category Programming

2014.02.22 Ji SangHoon in KJ-Code

Page 5: [KJ-CODE] 스터디 소개, category

Inherit• Vertical Inherit

• Make new class

• Can add new variable

• Can access variable (expect @private)

• Can add new method

• Can use override method

Page 6: [KJ-CODE] 스터디 소개, category

Category• Horizon Inherit

• Use original class

• Can not add new variable (except static variable)

• Can access variable (also @private)

• Can add new method

• Can not use override method

Page 7: [KJ-CODE] 스터디 소개, category

Inherit Category

Make New Class ○ ×

Add New Variable ○ △ (static variable)

Access Variable △ (expect @private) ○

Add New Method ○ ○

Override Method ○ ×

Inherit vs Category

Page 8: [KJ-CODE] 스터디 소개, category

@interface UIViewController (<Category Name>)

@interface <Class Name> : UIViewController

Category

Inherit

@interface OverlayViewController : UIViewController

@interface UIViewController (OverlayView)

Syntax

@interface MyTableViewController : UITableViewController

Page 9: [KJ-CODE] 스터디 소개, category

How To Make

File Name<Inherit Class Name> + <Category Name>.h / m

New File… -> Objective-C Category

Input Category Name & Select Category On Class

Page 10: [KJ-CODE] 스터디 소개, category

DEMO

Page 11: [KJ-CODE] 스터디 소개, category

Categories in DemoUIViewController+OverlayViewUIColor+DefineColor

UIImage+blur

UILabel+AutoSize

NSUserDefault+Addition

You can download Sample Source Code in Github

https://github.com/dunkeyike/KJ-Code_ALL

https://github.com/dunkeyike/KJ-Code_ALL/tree/master/20140215_category

All KJ-CODE Sample Source

Category Sample Source

UIView+ScreenShot

Page 12: [KJ-CODE] 스터디 소개, category

See Also..

Apple Developer Center - Customizing Existing Classes

http://blog.livedoor.jp/kurokawh/archives/2469395.htmlObjective-C:カテゴリで「できること」と「できないこと」

http://labs.torques.jp/2011/01/14/1596/Objective-Cの既存のクラスを拡張する仕組み

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html#//apple_ref/doc/uid/TP40011210-CH6-SW1