omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    navigationview subview size on iphone

    Pythonista
    3
    6
    1515
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • frankL
      frankL last edited by

      Is it possible to change the size of a navigation subview on an iphone? I have tried setting the frame parameters which hasn't worked. I have tried setting the bound parameters which will affect where the widgets are placed in the subview but not the size of the subview. Is there any way to resize the subview and, if so, how?

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        Do you mean the size of the navigation view itself? Or the size of the view that the navigation view is displaying?

        How are you presenting the view?

        1 Reply Last reply Reply Quote 0
        • frankL
          frankL last edited by

          I mean the size of the navigation window that is created when invoked. The one that is created is the same size as the primary view window. I create it using a view=ui.view() and sender.navigation_view.push(view)

          1 Reply Last reply Reply Quote 0
          • ccc
            ccc last edited by

            We need to see code. It is easier to debug Python code than English prose.

            1 Reply Last reply Reply Quote 0
            • frankL
              frankL last edited by

              This is the portion of the code that is relevant. The main view (named "view") has a button named "AddNext" that when pressed opens a subview from the function "add_next". This all works fine but I would like the subview to be smaller than the main view.

              Here is the crux of the code:
              import ui

              def add_next(sender):
              add_view = ui.View(frame = (0, 100, 414, 736))
              sender.navigation_view.push_view (add_view)
              return

              w, h = ui.get_screen_size()
              view=ui.View(name='test', bg_color='#D98880', frame=(0, 0, w, h))

              add_button = ui.Button(title='AddNext', frame=(250,65,280,100),border_color='black', border_width=2, corner_radius = 10, tint_color = 'black', background_color='yellow', action=add_next, font=('Arial Rounded MT Bold',18))
              add_button.width=100
              add_button.height=40
              add_button.enabled=False
              view.add_subview(add_button)

              nav_view = ui.NavigationView(view)
              nav_view.present('sheet')

              1 Reply Last reply Reply Quote 0
              • JonB
                JonB last edited by JonB

                First, it is strange,but view is not technically a subview of the navigation view. I forget what it is called, maybe content, or detail. Mostly semantics.

                Anyway, the way that navigation views work is that the view that you pass into the navview constructor, or push onto the nav view, gets resized to the navigation view size ( maybe with some offsets to account for the header, but that might be device dependent). The view's rightbuttons and leftbuttons get displayed in the navigation view at the appropriate place, and the title is shown in the nav view title spot.

                If your layout code isn't working, or you want larger margin, etc,you can have another container view that goes inside the view you are pushing. Then you have complete control over the size of that inner view (or you can use flex to allow it to scale, but maybe with a proportional border).

                That would allow you to layout the view that fits inside the nav view. Note that a layout method would also let you detect that the view size has changed, and then rearrange the bits inside the view to fit.

                If you are asking how you change the size of the outer nav view, on iphone, I don't think you have control over things presented as sheet. On ipad, you could set the size of the navigation view before you present, which would set size of the content to fit.

                If you are wanting the next_view to appear as a sort of floating "overlay" on top of the original view, then navigation view is not what you want. Instead, you likely want what is called a "shield" view - a semi transparent view that acts as a container for a smaller overlay window. A search for pythonista shield view should lead you to a class by polymerchm from some years back.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors