Proficient in iOS development-use of page bar and picker

Source: Internet
Author: User

First, page bar

Create a new project, subclass the value of Uiviewcontroller, then delete the root view in storyboard, and drag a tab Bar Controller at the bottom right

To add a page, simply drag a normal view controller from the bottom right, drag it from the page bar controller to the new view controller, and select View controllers under the relationship Segue heading in the popup panel. Use these pages to create cocoa Touch Class for them and associate them.

Set the title and icon at the bottom of the page bar,

Second, selector

The picker is divided into date picker and picker View, the former is the day picker, the latter is the general picker, can be arbitrarily customized use.

(a) To implement a function: Click the button, pop up a warning view displays the date and time currently selected in the date picker

1) Drag a date picker and a button to the date page and set the constraint

2) Create the output interface of the date picker, select Date picker, press and hold right-drag to the implementation file, create an output interface named DatePicker,

3) When this view is loaded, the picker resets to the current implementation code for the date and time, written in the Viewdidload method,

4) How to implement the function, select the button, press and hold right-click below the implementation file, create an action method named Buttonpressed, and write the code,

5) achieve effect, show Greenwich Mean Time

(ii) The implementation of the custom Picker view, the following note a few points, the same steps as above do not say

1) Implement the controller as a data source and delegate, associate Datesource and delegate,

2) Add the protocol in the. h file

3) Create an array that provides the data to the picker and assigns it to the Characternames property, with the following code:

4) The method of the button and the data source, the method implementation of the delegate, combined with

5) Achieve effect

Not to be continued ...

Proficient in iOS development-use of page bar and picker

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.