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.


    ui.NavigationView error?

    Pythonista
    3
    7
    4024
    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.
    • cg-mag
      cg-mag last edited by cg-mag

      I use this code.

      import ui
      
      def button_tapped(sender):
          v = ui.View()
          v.background_color = 'green'
          v.name = 'Pushed View'
          sender.navigation_view.push_view(v)
      
      root_view = ui.View()
      root_view.background_color = 'white'
      root_view.name = 'Root View'
      
      button = ui.Button(title='Tap me')
      button.action = button_tapped
      button.bring_to_front()
      button.background_color = 'gray'
      root_view.add_subview(button)
      nav_view = ui.NavigationView(root_view)
      nav_view.present()
      

      When I rotate my Iphone the button is cutting.
      https://pp.vk.me/c621928/v621928381/41dd5/LiEgFgmEZBo.jpg
      How to fix it? Thanks..

      And I have another questions. Can I run some script when user pressed the button 'back' at the navigation view? Thanks.

      1 Reply Last reply Reply Quote 0
      • cg-mag
        cg-mag last edited by

        Any comment?

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

          Patience is a virtue! Does the button partially appear only in landscape? Or does the problem occur in portrait as well?

          1 Reply Last reply Reply Quote 0
          • cg-mag
            cg-mag last edited by

            @Gerzer said:

            Patience is a virtue! Does the button partially appear only in landscape? Or does the problem occur in portrait as well?

            Start program at portrait. When rotate phone button was partially apearing.

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

              Experiment with the flex attribute of the button, and perhaps root view and your Navigation view. the nav and rootview probably should be 'wh'.

              I will point out that you have not actually set the frame of the button, or root view for that matter, which may be part of the issue.

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

                Re detecting the back button, here is a method, not ideal but it works:

                https://forum.omz-software.com/topic/1324/navigationview-on-screen

                1 Reply Last reply Reply Quote 0
                • cg-mag
                  cg-mag last edited by cg-mag

                  @JonB , Thank you!! I'll try.

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