mercredi 24 juin 2015

IOS / hierarchal view controllers

I have the following layouts in an IOS app: IOS layouts

The four coloured rectangles are UIViewTables. Much of this is already implemented, but with only one UIViewController that handles all of the views.

As the code is getting quite complex, I am wondering:

1) Would be better to split up the code with one controller for each of the four UIViewTables?

The tables are in themselves quite complex, so I assume the answer is yes, but maybe there are other ways to deal with this complexity.

2) How could such a hierarchy be implemented?

I have tried variations of the this patterns (this code is placed inside initWithNibName of the parent controller):

[self addChildViewController:child];
self.view.frame = self.view.frame;
[self.view addSubview:child.view];
[content didMoveToParentViewController:self];

...but the sub views are not rendered.

The sub views are not ready when this code are run (reloadData/reloadSections are called later). Should the parent be informed about child reloading?

Since most of the views are implemented already, I am doing this programatically (as opposed to using storyboard).

See more ..

Aucun commentaire:

Enregistrer un commentaire