Introduce KJ-CODE 2014.02.22 Ji SangHoon in KJ-CODE
Introduce KJ-CODE
2014.02.22 Ji SangHoon in KJ-CODE
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
iOS DEV 2010 ~
Who Am IGame Dev
Embeded System Dev
Objective-C Category Programming
2014.02.22 Ji SangHoon in KJ-Code
Inherit• Vertical Inherit
• Make new class
• Can add new variable
• Can access variable (expect @private)
• Can add new method
• Can use override method
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
Inherit Category
Make New Class ○ ×
Add New Variable ○ △ (static variable)
Access Variable △ (expect @private) ○
Add New Method ○ ○
Override Method ○ ×
Inherit vs Category
@interface UIViewController (<Category Name>)
@interface <Class Name> : UIViewController
Category
Inherit
@interface OverlayViewController : UIViewController
@interface UIViewController (OverlayView)
Syntax
@interface MyTableViewController : UITableViewController
How To Make
File Name<Inherit Class Name> + <Category Name>.h / m
New File… -> Objective-C Category
Input Category Name & Select Category On Class
DEMO
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
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