Note that there are some explanatory texts on larger screens.

plurals
  1. POController, View, Delegation - how to design properly
    primarykey
    data
    text
    <p>Searched other questions but still no answer ... Need some advise. I am porting my code from another platform to iOS. I have an MVC backbone in C++ : CData for model. CController for controller. </p> <ul> <li>CController creates an instance of CData</li> <li>CController creates an instance of CView</li> <li>CController inherits from CNotifications abstract</li> <li>CController passes "this" to constructor of CView</li> <li>CView expects CNotifications* in the constructor and this is how the CView can call the controller back on some important events without actually be aware of the CController itself</li> </ul> <p>On Windows CView would simply access GDI to draw whatever was needed. </p> <p>Now I am porting all this to iOS. CData and CController are completely platform independent so all clear. I was going to just re-implement the CView over iOS. And this is where the problem is.</p> <p>At the start I wanted my ViewController of ios ( the owner of the xib ) just to inherit from CView and implement all CController needs. But then I noticed that there is no multiple inheritance in Obj-C and the ViewController already inherits from UIViewController.</p> <p>So it seems I need to implement CView in such a way that it has a pointer to ViewController( the owner of the xib ).</p> <p>And the question is : how to nicely pass to CView a pointer to ViewController ?</p> <p>I planned the ApplicationDelegate to create the CController which would create the CData and the the CView. I dont want CController to receive a pointer to ViewController and then pass this pointer further to CView - I want CController stay portable...</p> <p>There are all sorts of things coming into head but I was hoping to get here a widely-acceptable approach</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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