views:

54

answers:

2

Hi all, as the tilte is possible autoimport or there is an option in xcode that allow to import all callbacks of a delegate(as MKMapviewdelegate or other)?

I use this option in Eclipse (Java) to import getters/setters methods to access class variables.

Thanks in advance.

+1  A: 

You can't really "import" accessors and mutators, you'd have to inherit them. They have to be created by @property and @synthesize directives or manually. You could declare that your class implements a protocol, but you'd still need to define properties and create accessors/mutators whether using @synthesize or manually.

Hope I understood your question properly. I don't think xcode has any way to automagically create properties to wrap specified instance variables. If it does then I haven't found it yet (which is possible).

Nimrod
Thank you, i know @property/@synthesize to access class attributes, but what i mean is just a simple way to import all callbacks of delegate that my class implement. Is terrible to say but like in java, if you want use an interface you have to implement all the methods of the interface, so with Eclipse you can import all these methods from an option panel.
Mat
Well, I don't remember about Java, but Objective-C has optional interface methods. So at least with a lot of the UI delegate protocols you don't actually need to implement everything.
Nimrod
Thanks again, but maybe you've not understand my question. Java/Eclipse was just an example of what option i'm looking for. So for example, when i start to implement an app location based usually I use all callbacks of MKMapViewDelegate and always I have to jump to definition of the delegate and copy and paste(note that there are all Apple's comment) delegates.what I want is a way to autoimport all these delegates in my implementation file....if exist!
Mat
I see what you mean. I think the current version of xcode is a bit limited in this regard, but you can use text macros and maybe templates to help a little bit. That's the only thing I really know of though. Check this out: http://www.turkeysheartrhinos.com/?p=8 Hopefully the next version of xcode will be more extensible or something. There's that beta version but I'm a little afraid to install it....
Nimrod
good link..thanks
Mat
+1  A: 

The easiest way I've found is to just copy from the header file and add {} (and optionally delete the semicolon; Objective-C allows a semicolon before the { for some reason).

tc.