Shai UI
Shai UI

Reputation: 51948

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 implementation 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

Upvotes: 0

Views: 735

Answers (2)

Eric Baker
Eric Baker

Reputation: 357

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.

Upvotes: 4

WrightsCS
WrightsCS

Reputation: 50707

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.

Upvotes: 1

Related Questions