Using different frameworks in my projects I have often faced with custom elements which created as class inherit from NSObject (correct me if something is wrong). What are the main rules of creating such UI elements?
Using different frameworks in my projects I have often faced with custom elements which
Share
NSObjectis the very basic class in Cocoa. It is responsible for the most basic things that every class needs, like memory management. (Almost) all classes in Cocoa inherit fromNSObjectand you usually subclassNSObjectif you want to implement a model class.If you want to create your own GUI element, you should subclass
UIVieworUIControl.UIViewwill give you capabilities to do custom drawing, handling touch events and others.UIControl(which itself is aUIViewsubclass) adds functionality for control elements which the user can interact with, likeUITextField,UISlideretc. This is what you should subclass if you plan to implement a custom control.