iPhone: Can I split a ViewController's implementation into more than one file?
So say I have:
MyViewController.h MyViewController.m
I'd like to have: MyViewController.h MyViewController1.m MyViewController2.m (or however many I need)
Kind of like partial classes in .NET, it just makes it easier to organize things... So is there a way to split an implementati开发者_如何学Con up to more than one file? If so how do I do this? and note that my viewcontroller has a .xib associated with it. Thanks
You can use categories in Objective-C to split your implementation portion of your class. This allows you to logically split your class's methods into separate files.
In short, yes you can. As long as you can follow your structure and not get confused, I don't see any issue in it.
Erica Sadun follows the same structure in her examples.
Now, when you get into using XIB's, then you start conflicting.
精彩评论