"logic" in view or view?

Hi guys, I plan to write a numerical / 7-segment LCD for iphone.
(a display consisting of several numbers, each of which consists of 7 (dashes) segments.)

  • My question is, after the mvc template, where does the code for parsing numbers belong? View or its controller?

    So, should the controller skip the view only the number to display, allowing the -drawRect method to figure out which segments will be lighter?

    Or should the controller skip the view directly, which segments to highlight after it detects this in the method inside the controller class?

    As I have learned so far, the controller is responsible for all logical things. But Iโ€™m not sure what this logic means.

  • Oh, and by the way, should the controller just set the properties in the view, or would it be better to call the controller as a delegate from the view class to retrieve the data?

+4
source share
1 answer

I would say that the look should determine which segments to draw. Ideally, you can turn your application into an analog clock by simply changing the view (since the numbers delivered from the controller will not change.) Although you do not want your view to execute business logic, โ€œvisualโ€ logic (how the data should be drawn ) is definitely in sight.

+3
source

All Articles