A simple time picker WHTimePicker

Objective

This article to share with you one of my time to make WHTimePicker easy to use selector. (support Pod, if pod does not arrive, please pod setup first)

A simple time picker WHTimePicker
WHTimePicker

Gif effect (Figure 1)

A simple time picker WHTimePicker,
, figure 1

! Note: you need to use the Masonry framework

Masonry is used in WHTimePicker. If
download GitHub use (you can easily point to a star, thank you), please in the project into Masonry.
, if it is pod ‘WHTimePicker’, will automatically import Masonry for you

Steps to create WHTimePicker

1. import header file

A> > downloads directly in GitHub; uses WHTimePicker:#import “WHTimePicker.h”
b> > or installs to the project using CocoaPods: #import < WHTimePicker>

2. add agent

@interface ViewController (&lt) (Figure 2); WHPickerDelegate>

A simple time picker WHTimePicker
, figure 2,

3. initialize create WHTimePicker

(Figure 3) WHTimePicker has a class creation method in which the frame uses self.view.bounds directly.
generally add WHTimePicker to keywindow.
top to determine the background color and text color bar can customize the default for blue and white.

A simple time picker WHTimePicker,
, figure 3

4., the realization of agent method one

(Figure 4) select a good time, click OK, then callback the proxy method, and string is the content of the selection.

A simple time picker WHTimePicker,
, figure 4

5. implementation agent method two

(Figure 5) callback this method when the time picker disappears. For example, click “Cancel” / “OK” / page blank.

A simple time picker WHTimePicker,
, figure 5

GitHub address: https://github.com/remember17