PDA

View Full Version : Question about a new SplitView Application




ulbador
Jul 22, 2010, 11:21 AM
When you create a new Split-View Application in XCode, I am trying to get a handle on something.

I am completely not understanding a bit in the DetailViewController.h/.m.

Of course in the .h file, it has the expected:

@interface DetailViewController : UIViewController ......


But in the .m file it also has:

@interface DetailViewController ()

and then another method and property declaration. I have never seen code like this in the .m file.

I can't get my brain around it...



robbieduncan
Jul 22, 2010, 11:27 AM
It's an anonymous category allowing for a truly private interface to be added. Basically it allows that property and method to exist and be visible to all methods in the class but not visible outside the class as they are not part of the public .h file.

ulbador
Jul 22, 2010, 01:00 PM
It's an anonymous category allowing for a truly private interface to be added. Basically it allows that property and method to exist and be visible to all methods in the class but not visible outside the class as they are not part of the public .h file.

Ahh, that makes total sense! I suppose something like this would be required since objective C seems to lack the ability to make private methods (in the traditional sense)

Thanks!