开发者

Class Method Example in objective -c

can anyone tell me how to create a class method 开发者_JS百科and using that how can we share an object DATA in all classes......?


A class method has no state therefore can't do what you're asking for. You want to create a singleton object and pass that around. Check out Singletons, AppDelegates and top-level data for a discussion of singletons and a handy macro for automatically creating them.


-(returnType)methodName; --> this is your normal object method

+(returnType)methodName; --> this will be your class method

[Classname methodName] --> This is how you will call the class method

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜