开发者

Referencing to objects from anywhere in Cocoa

What's the best way to 开发者_StackOverflow社区reference to a dynamically allocated object (particularly interface elements) so I can access them from everywhere in the current class? @synthesize? declaring the object in the interface section? anything else?


This is the very definition of an instance variable, which — as you've noted — is what you get when you declare the object in the interface section.

@synthesize gives you syntactic sugar for correctly creating accessors, but that's another layer on top. It can do the instance variable creation for you in some cases, but that's another topic entirely.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜