iphone - How to start NavigationController after button press in rubymotion -


i'm trying simple app in rubymotion first time. want able click button , start uinavigationcontroller

steps: - user presses button - screen moves left , new navigation starts

i can fine if start navigation first view want able start @ button push.

here have far

appdelegate:

#below commented line starts navigation first view #navcontroller = uinavigationcontroller.alloc.initwithrootviewcontroller(homecontroller.alloc.init) @window.rootviewcontroller = homecontroller.alloc.init true 

homecontroller:

  def viewdidload     self.title = "one"     button = uibutton.buttonwithtype(uibuttontyperoundedrect)     button.frame = [[15,300], [280,50]]     button.settitle("move next view", forstate: uicontrolstatenormal)     button.addtarget(self,                       action: "startnavigationone:",                      forcontrolevents: uicontroleventtouchupinside)      view.addsubview(button)   end    def startnavigationone (sender)    #what can here start navigation? 

end

haven't tested code , writing memory, should work.

def startnavigationone (sender)   # create next controller , navigation controller   next_controller = uiviewcontroller.alloc.initwithnibname(nil, bundle: nil)   nav = uinavigationcontroller.alloc.initwithrootviewcontroller(next_controller)    # set root view controller   uiapplication.sharedapplication.delegate.window.rootviewcontroller = nav    # current uiviewcontroller deallocated when method exits end 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -