开发者

Difference between variable positions in a header file

开发者 https://www.devze.com 2022-12-15 15:04 出处:网络
What is the difference between me declaring开发者_如何学编程 something within the @Interface section of a header file and outside of the { }?

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

精彩评论

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

关注公众号