开发者

Difference between variable positions in a header file

What is the difference between me declaring开发者_如何学编程 something within the @Interface section of a header file and outside of the { }?

I want to be able to get to my properties in my interface at all times, i.e. in an IBAction method so do I always need to use synthesize in the implementation file?

Cheers

Paul


In {} block you define class instance variables.

Outside {} but in interface section you define methods (i.e. messages that class or its instances may respond to).

To access class members within its methods you do not need to define anything else. However if you want to access your members outside your class you should define methods for that. Objective-C allows you to automatically generate accessors by defining them as properties and synthesizing in implementation class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜