Uinavigationcontroller (Navigation Controller)

Source: Internet
Author: User
Tags border color


1.UINavigationController (Navigation Controller)

 

What is 1.1?

Inherited from Uiviewcontroller, is still a controller,

This controller does not have a specific view, is the controller of the management controller

1.2 advantages?

Be able to manage and control the trend of VC, more clear than present way

hierarchical push ... pop ...

There is no hierarchy of present ... dismiss ...

1.3 How do I use it?

Step1: Creating an instance of Uinavigationcontroller

Step2: Create a specific VC instance and set this VC as the root view controller for Uinavigationcontroller

Step3: Set Navigationcontroller as window's root view Controller

STEP4: When you want to launch a new VC, you can use the Pushviewcontroller method

STEP5: If you want to fall back to the previous VC, you can not write code, or use the Popviewcontroller method

1.4 Internal principle

1) There is an array inside Navi that can store multiple VCs, which is the Self.navigationController.viewControllers property, and this array uses "stacks" to manage the data. "Stack" features: Advanced after out, LIFO first.

2) Navi must have a root view controller as the first display of the VC

3) push out a new VC, is the stack attribute into the stack of a VC object, the new VC into the stack before the VC display will not be released

4) Pop existing VC, is to release this VC

5) cannot pop root VC

1.5 Configuring the Navigation bar

Access navigation bar: Self.navigationitem

The navigation bar contains three parts:

1) The middle title

self.title= @ "";

2) button area on the left

self.navigationitem.leftbarbuttonitem/s

3) button area on the right

self.navigationitem.rightbarbuttonitem/s

4) Type of button: Uibarbuttonitem type

You can use Initwithtitle. method to create a custom

Buttons for text content

You can use Initwithbarbuttonsystemitem ... method to create a system-defined button with a fixed appearance

1.6 Configuring toolbars

Access Toolbar: Self.toolbaritems

Toolbars are hidden by default and modify the following properties to display

Self.navigationController.toolbarHidden = NO;


The Uibarbuttonitem type of button is also loaded in the toolbar

1.7 Effects button

uibarbuttonsystemitemfixedspace Stick Effect: The distance is fixed. Adjust the width of the button by modifying the Barbutton property

uibarbuttonsystemitemflexiblespace Spring Effect: The distance is variable, you can adjust the width of the button according to the external width

1.8 When introducing a new VC, set the bottom bar area to hide

bvc.hidesbottombarwhenpushed = YES;


1.9 Navigation controllers can set the action of the properties on the range

Property:

. title

. navigationitem.leftbarbuttonitem/s

. navigationitem.rightbarbuttonitem/s

. toolbaritems

The settings for the above four properties are only responsible for the currently owned VC

Property:

. Navigationcontroller.toolbarhidden

After setting, all VCs managed for the navigation controller are in effect

1.10 Q: Self.navigationcontroller can be accessed in different VCs, so is it the same navigation controller?

Answer: Yes

2. Uiimageview

Data type: Nsstring->uilabel display

Uiimage->uiimageview Display

2.1 How to use

Property:

Contentmode to set how content is displayed

Uiviewcontentmodescaletofill:

Modify the aspect ratio to fit the area of the ImageView, and the picture will be stretched without leaving white edges

Uiviewcontentmodescaleaspectfit:

maintain the width and height ratio of the case, the entire picture is visible , due to the picture's aspect ratio and the set ImageView frame's aspect ratio if uncoordinated, may leave the white edge.

Uiviewcontentmodescaleaspectfill:

keeping the aspect ratio constant, fills the area of the ImageView, so only a portion of the picture will be displayed and will not remain white

"Demo2_uiimageview"

Properties:

Layer.cornerradius set the radius of the fillet

Layer.maskstobounds Turn on edge masking

Layer.borderwidth Setting the border width

Layer.bordercolor Setting the border color


3.UIScrollView

3.1 Effects:

Show more data or pictures within a limited area

3.2 Nature:

Managing view's View,scrollview itself does not have any appearance, relying on other views added to the ScrollView to complete the display of the interface

3.3 How to use

Important attributes:

. Frame Settings ScrollView How much window to display the content

. contentsize Sets the size of the scrollable area

. Contentoffset sets the offset coordinates of the frame fixed point to the left vertex of the content

. Contentinset Set the top, left, bottom, and right distances between content and boundaries

Other properties:

. Bounces can bounce

. showshorizontalscrollindicator whether to show horizontal scroll bars

. showsverticalscrollindicator whether to display vertical scroll bars

. Indicatorstyle

3.4 How to zoom in on scrolling view content

Step1: Set the maximum ratio for scrolling content scaling

Step2: Set the minimum ratio for scrolling content scaling

Step3: Answer the question, indicating which sub-view inside the scrollview needs to be scaled

======================================================================================



This article is from the IOS blog, so be sure to keep this source http://20150101.blog.51cto.com/9157674/1696850

Uinavigationcontroller (Navigation Controller)

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.