본문 바로가기
모바일개발(Mobile Dev)/IOS개발(ObjectC)

UIDatePicker example in iOS

by 테크한스 2015. 9. 17.
반응형

UIDatePicker example in iOS

              In the previous tutorials we have worked around custom UITableViewCell and UIWebView. Now in this tutorial I am going to show you how to implement an UIDatePicker in iOS development.

        UIDatePicker is used to select a specific date and time in the iOS app development process. UIDatePicker class implements an object that uses multiple wheels from which user selects date and time. Read apple documentation about UIDatePicker.

uidatepickFeatured.jpg

Overview

In this tutorial I am going to create an iOS application which displays the user selected date and time from UIDatePicker through UILabel.

Getting Started

    Create a new Xcode single view application. Enter the project name as ‘UIDatePickerExample’. Enter the organization name and company identifier details. Select the device as ‘iPhone’. Select next to save the project.

   createProject.png

         

       Select the Main.Storyboard file. Drag and drop an UIDatePicker and UILabel over the ‘ViewController’ scene. Now your view should look like this,

app development process

              Create an IBOutlet for the UILabel and UIDatePicker as ‘selectedDate’ and ‘datePicker’ respectively. 

dateOutlet.png

         Now create an IBAction for the UIDatePicker as ‘pickerAction’ as below.

app development process

Implement Code

       Add this code below inside the method ‘pickerAction’ in the file ViewController.m.


반응형