Some knowledge of multi-view programming

  1. Each view can choose an associated class: class
  2. The arrow points to the starting view, which is the first view, which can also be selected through the check box
  3. There is an inherited UIViewController view in each viewController, and various things of this view can be set through the view
  4. Select Tabbed App to create a multi-tab app (or select Editor->Tab Bar Controller). If you need to add more tabs, drag it directly into the view controller, then right-click in the Tabs Bar Controller, and click the + on the view controller that appears. Extend the long line to the newly dragged view controller (or ctrl+right button), and you can add a new tab.
  5. You can choose cocoa Touch class or Swift File to create a new view file. You need to call super.viewDidLoad() when you override the method.
  6. textbox resign keyboard myTextInput.resignFirstResponder
  7. Tabbed View, let tabBarController = self.tabBarController?.viewControllers?[0..N] as viewController to get the required viewController, but if the view has not been displayed, it will not get a new view, you can first use the second view Declare a string in, and then set it in the viewDidLoad of the second screen.
  8. How to set the jump of TabBarController, directly set TabBarController.selectedIndex = 0...1 to set the jump, select the image of the bar Item to change the icon


The second multi-view programming

  1. Drag in multiple viewControllers, and then use ctrl+pull to jump to the second screen
  2. Separate the view and the navigation controller through editor->Embed in ->Navigation Controller (if you don't use this, from bottom to top), so that the animation cuts in from right to left; or drag in the Navigation Controller and drag it into the storyboard, then Delete his own viewController, and then ctrl+line pulls in the line by himself, select the checkbox of Is Initial view controller, and the first viewController wrapped is the root view controller.
  3. You can add Bar Button Item on the navigation bar (note the difference with the Navigation bar), jump to the next view, or you can pull in the next view and import the next view controller
  4. Navigation item can be used as the label of Navigation bar (note the difference from Bar Button Item), which summarizes the theme of this view
  5. storyboard ID, set the storyboard id, then create the view through UIStoryboard, and then display the view through present (from bottom to top, from right to left from navigationController), if there is a navigationController, you can use pushViewController to show.
  6. Go back to the previous view, navigationController.popViewController(animated: true), or popToRootViewController(animated: true), you can use this function when you need to push it.
  7. The third way to transition segue, through the connecting line to transition, performSegue("gotoview2", sender: inputText)
  8. prepare里面选择segue,if segue.identifier == "gotoview2" if let lightRed = segue.destination as LightRedViewController, lightRed.infoFromViewOne = sender as? String
  9. Relinquish focus myTextInput.resignFirstResponder()
  10. pickerView needs to set dataSource and delegate, numberOfComponents, pickerView, pickerView these methods need to be implemented
  11. The delegate calls back the method of the previous interface, so that the value is passed back and forth, define the delegate in the next interface, implement the delegate in the previous interface, set the value when the previous interface jumps to the next interface, and call it when returning to the previous interface .


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325542462&siteId=291194637