Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ulbador

macrumors 68000
Original poster
Feb 11, 2010
1,554
0
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...
 
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.
 
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!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.