views:

109

answers:

3

hello, 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.

  5. 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.

+1  A: 

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

ennuikiller
ok. so base on the following which step i will put in the model and controller (view i created in the IB).
nil
A: 

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.

Gordon
A: 

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.
Adam Alexander
thanks for your help.
nil