003-multi-view controller switching

Source: Internet
Author: User
Multi-view controller switching 1. Container Concept

• An iOS app is rarely composed of only one viewcontroller, unless the app is extremely simple. When the app has multiple viewcontrollers, you need to manage these viewcontrollers.

• Container concept: displays one or more viewcontrollers and manages their lifecycles.

•? Some containers are also a viewcontroller, which is called a container by the container management controller? Controller (childviewcontroller ),? The container is called the parent controller (parentviewcontroller)

• A very small number of containers, such as uipopovercontroller, are inherited from nsobject. Note: uipopovercontroller can only be used on iPad?

2. Container features

• You can add, remove, or switch between childviewcontroller

• Instances that hold all childviewcontroller (typically in nsarray)

• In Charge Of the view of childviewcontroller? Call of Life Cycle Method

-Viewwillappear
-Viewdidappear
-Viewwilldisaapper

-Viewdiddisappear-rotation event

3. Several Common switching methods of the visual controller in IOS

1. tabbar Tab
-The uitabbarcontroller is used as the container to manage the sub-View Controller in parallel.

• 2. Push
-Is the container managed as a stack using uinavigationcontroller? Sub-View Controller

• 3. Modal Mode
-Modal window ?? Display the New View Controller. Before the New View Controller is disabled ,? User? Method to interact with other controllers

Modal window? Port features

• Is it used separately? Window used ?? Port, independent of container View Controller
• Normal? Used for explicit? Relatively independent display? Li's window ?? Port, for example :? User Login, response? Usage

Sequence setting or help information
•? The user closes the modal window ?? Cannot be connected to the upper port? Level 1 view? Row Interaction

  4. uitabbarcontroller, navigationcontroller

1. What is uitabbarcontroller? Use attributes

• Title: Title
• Image: Images
• Badgevalue: upper right? Corner icon
• Viewcontrollers: All? Sub-View Controller

• Note: When the tabbarcontroller is instantiated, all the subview controllers are loaded.

 

2. How uinavigationcontroller works

•? Principle: Manage in stack form? Sub-View Controller

• Uinavigationcontroller:

-Upper? The plane is uinavigationbar.

-Bottom? The plane is the view of the topviewcontroller. The navigationitem attribute of the topviewcontroller determines the uinavigationbar display? Content

In uinavigationcontroller? Use attributes and? Method

• Regular? Use attributes

  1. Childviewcontrollers? Sub-View Controller

  2. Title

  3. Backbarbuttonitem return button

  4. Left button of leftbarbuttonitem

  5. Rightbarbuttonitem

    • Regular? Use? Method

    • -Will pushviewcontroller press the specified view controller? Top of the stack

    • -Popviewcontrolleranimated: pops up the current view controller from the stack.

  5. What about the segue object? Lifecycle

• Create? Target View Controller

• Create a segue object and call? Use its initwithidentifier: Source: Destination :? Method

• Mark? Is the identifier specified in interface builder? One mark? String. The other two parameters correspond to the start controller and the start controller of the arrow respectively? Target Controller

• Tune? Use the source View Controller's prepareforsegue: Sender :? Method call? Use the perform of the segue object? Method? Target View Controller pushes to the screen to release the segue object

PS: multi-view controller jump method summary

• Model
-Enable: presentviewcontroller: animated: Completion:-Disable: dismissviewcontrolleranimated: Completion:

• Push
-Enable: pushviewcontroller: animated:-Disable: popviewcontrolleranimated:

• Segue

-OK? Can it be used for modal? Used for push

-If yes ?? The Target Controller requires additional processing. You can use javasmseguewithidentifier: Sender :? Method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.