Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom UIView as UITableView delegate and datasource?
    text
    copied!<p>I am writing a fairly complex iPad app - my first bigger one.</p> <p>This app has some custom UIViews that present fairly complex data, including a table. These views do not take up the whole screen, and there can (and likely will) be many of them on screen at any time (though only one would be in an "expanded" state where the table is shown).</p> <p>Here's a basic example that should convey the basic principle: <img src="https://i.stack.imgur.com/CgaY6.png" alt="Made with the nice Antetype prototyping app"></p> <p>Please note that these things are not supposed to be in popovers; instead, the FamilyViews expand to show their detailed data. (And please also note that this mockup was only created for the sake of this question and has little to do with how my interface is going to look; I know this is not good screen design)</p> <p><strong>I'm undecided on who to put as the delegate and datasource of these custom views:</strong></p> <ul> <li>Making the <strong>ViewController</strong> for the current screen delegate and datasource is unelegant, because it's not just one table that's part of the VC's main view.</li> <li>Making the <strong>View</strong> itself the delegate and datasource seems a bit weird to me because it feels like giving the view too active a role; making it into a half-controller.</li> <li>Making the underlying <strong>model object</strong> the datasource seems too tightly coupled, and also breaks MVC. And it doesn't answer the question of who should be the delegate.</li> </ul> <p>I'm tending towards making each of these "FamilyViews" delegate and datasource for their own tables. Action on these tables will have to be coupled to the FamilyView's delegate (the ViewController), but that shouldn't be a problem, should it?</p> <p><strong>Anyone have some input on this?</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload