Skip to Content
Learning the iOS 4 SDK for JavaScript Programmers
book

Learning the iOS 4 SDK for JavaScript Programmers

by Danny Goodman
December 2010
Beginner to intermediate
320 pages
10h 3m
English
O'Reilly Media, Inc.
Content preview from Learning the iOS 4 SDK for JavaScript Programmers

Creating a Date Object

Working with the JavaScript Date object is the bane of many programmers, mostly due to the need for web pages to operate for a global audience where formats and time zones confound even the best of plans. If you thought that the JavaScript Date object was a headache, I don’t have good news for you on the Cocoa Touch side of things. To perform even simple tasks often requires navigating through multiple classes dealing with dates, calendars, and date components—and that’s not even getting into the formatted display of date and time data. That’s one reason why the discussion involving dates is spread across a few sections in this chapter.

Despite this potentially fearsome complexity, one factor that is actually much simpler to deal with in an iOS app is obtaining a valid date and time input from the user. The whole issue of validating text field entries in web forms thankfully becomes a nonissue with the aid of the UIDatePicker control, shown in Figure 9-1.

The UIDatePicker control

Figure 9-1. The UIDatePicker control

Adding a UIDatePicker to Workbench

If you want to try out some of the examples dealing with dates, I recommend you add (at least temporarily) a UIDatePicker control to the Workbench app, as well as a method that executes when a user chooses a date. Begin by adding a little bit of code to the WorkbenchViewController class files. First, add the following method declaration to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

iOS SDK Programming A Beginners Guide

iOS SDK Programming A Beginners Guide

James Brannan, Blake Ward

Publisher Resources

ISBN: 9781449399078Errata Page