Pushing a navigation controller is not supported- performing segues

后端 未结 4 992
庸人自扰
庸人自扰 2020-12-31 05:20

I created a new navigation controller in my storyboard (not programmatically!) and set it to be \"Root View Controller\" to a regular UIViewController and added a button in

4条回答
  •  甜味超标
    2020-12-31 05:53

    I've tried this and have no problems, its all done in IB with no additional code required ...

    1. Start a new project, "Single View Application" using story boards
    2. Select storyboard and delete the views its produced.
    3. Drag on a new Navigation Controller (it will bring a table view with it)
    4. Delete the table and the table view controller, so you are just left with the Navigation Controller
    5. Drag on a normal view controller
    6. Right Click and drag from the Navigation controller to the new View and choose "Relationship - Root View Controller"
    7. Drag a "Bar Button Item" on to the Navbar which should be visible on the top of your ViewController, you can rename this Forward if you wish.
    8. Now drag on another view controller which is the one your "Forward" button will push in to view.
    9. Right Click and drag from the bar button to the 2nd View Controller, and choose "Push"

    Run the project and you will get a Single view with a Navbar and your button, clicking your button will Push the other view and give you a Back Button to return to the first View Controller. I'll try and post a picture of my storyboard if it helps.

    PushViewControllers

    Plasma

提交回复
热议问题