GithubHelp home page GithubHelp logo

Comments (4)

defagos avatar defagos commented on June 9, 2024

Conceptually, a CoconutKit-based navigation view controller can be obtained by subclassing HLSPlaceholderViewController to embeds an HLSStackController instance and a navigation bar at the top. When the view controller displayed by the stack changes, the navigation bar can be updated by the HLSPlaceholderViewController accordingly (most probably using the child view controller -navigationItem information).

If I were to implement a CoconutKit-based navigation view controller, I would do things differently, though. A direct HLSPlaceholderViewController subclass interface would namely be polluted by the parent class interface, which I strive to avoid. To solve this issue, I would most definitely build my implementation on the HLSContainerStack class. But if you do not need this custom navigation controller to be easily reused in another project, this might be overkill and you should simply inherit from HLSPlaceholderViewController.

from coconutkit.

mmmilo avatar mmmilo commented on June 9, 2024

would namely be polluted by the parent class interface

Did you mean because just using HLSPlaceholderViewController on its own looks too heavy? Perhaps I'm confused by what you mean, but HLSPlaceholderViewController looks fairly lightweight (just a stack per each placeholder).

Of course the navigationItem per each push is generated automatically so doesn't need to expose a "push" on it's own.

Thanks for the input!

from coconutkit.

defagos avatar defagos commented on June 9, 2024

If you want to implement a custom navigation controller using existing CoconutKit containers, you should start by subclassing HLSPlaceholderViewController (with two views, one navigation bar at the top, and one placeholder view below, in which a stack controller will be displayed). But doing so you will inherit all the methods of HLSPlaceholderViewController, and those do not make sense for a navigation controller, which essentially requires push and pop methods. In fact, there is no is-a relationship between a navigation controller and a placeholder view controller.

This can be done, of course, but the resulting class interface will look ugly. If all you need is a quick solution for a single project, this is still a viable option, though. But if you start implementing custom navigation controllers this way all the time, you should consider using HLSContainerStack instead. This is the best way to design and implement a navigation controller class you and others can easily reuse

from coconutkit.

mmmilo avatar mmmilo commented on June 9, 2024

Understood, thanks for the clear answer!

from coconutkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.