nil
nil

Reputation: 25

Beginners question - do i need to separate my class to different classes?

i have a UIViewController class that do the following:

  1. detect movement.

  2. array a bunch of images and do some orders manipulation.

  3. insert images to the view.

  4. animate some images.

    • btw there are a lot of objects in the class (60).

do i need to separate some of this steps to different classes ? if so why and to which class type.

tia.

Upvotes: 1

Views: 134

Answers (3)

Adam Alexander
Adam Alexander

Reputation: 15180

I feel this is somewhat subjective, but personally I'd separate them as follows:

MODEL:

  • array a bunch of images and do some orders manipulation.

VIEW:

  • detect movement. (but only tell the controller, controller should react to the movement)
  • animate some images.

CONTROLLER:

  • insert images to the view.

Upvotes: 0

Gordon
Gordon

Reputation: 4843

Might be an idea to get a book like Beginning iPhone Development. As ennuikiller said iPhone applications are built using the model, view, controllers concept. The book bring you's up the core ideas of how to develop iPhone applications.

Upvotes: 0

ennuikiller
ennuikiller

Reputation: 46965

Usually you'll want to have separate classes for your model, view, and controllers. Therefore if you'll usually have something like this:

MyViewController.m, MyView.m, MyModel.m

at the very least. Note that if you build your view with IB then you'll have a MyView.xib file instead of MyView.m.

This would be only a beginning point however. Depending upon the complexity of your app you'll probably wind up with many more classes that factor out common state and functionality. In general it is a bad idea to put everything into one class. This holds as much for any oo language as it does for objective-c

Upvotes: 1

Related Questions