iOS 4 SDK入门:给JavaScript程序员(英文影印版)
基本信息
- 作者: Danny Goodman [作译者介绍]
- 丛书名: 东南大学出版社O'Reilly系列
- 出版社:东南大学出版社
- ISBN:9787564127107
- 上架时间:2011-7-20
- 出版日期:2011 年5月
- 开本:16开
- 页码:297
- 版次:1-1
- 所属分类:
计算机 > 软件与程序设计 > 网络编程 > javascript
内容简介回到顶部↑
javascript程序员有没有可能学习apple的ios 4 sdk编程并且坚持到成功一刻呢?技术大师danny goodman做到了这一点,而且留下了这本有着清晰足迹可以让你跟随的书。作为自javascript诞生之日起就是权威专家的goodman清楚你在使用sdk创建本地ios应用时会遇到的挑战,他使用一种你容易理解的上下文来介绍xcode、objective-c和cocoatouch。
当你能够简单地为apple的ios设备创建web应用时,你为什么还需要顾虑sdk呢?这是因为web应用无法访问iphone的音乐库、相机,或者为地图、音频以及其他东西设计的ios系统软件。你也无法在应用商店里销售web应用。如果你希望发挥iphone和ipad的全部优势,ios 4 sdk就是你所需要的工具——而本书就是你所需要的参考书。
·了解web应用和ios本地应用编程的差异 ·创建一个工作台应用来测试贯穿整个学习过程的代码段
·理解ios应用的结构,比较通过objective-和javascript搭建对象的过程
·揭示你的代码如何启动ios应用并让它们准备就绪 ·学习ios内存管理,以及与javascrip程有所差异的objective-c指针和数据类型
·使用objective-和cocoa touch实现常见的javascript任务
当你能够简单地为apple的ios设备创建web应用时,你为什么还需要顾虑sdk呢?这是因为web应用无法访问iphone的音乐库、相机,或者为地图、音频以及其他东西设计的ios系统软件。你也无法在应用商店里销售web应用。如果你希望发挥iphone和ipad的全部优势,ios 4 sdk就是你所需要的工具——而本书就是你所需要的参考书。
·了解web应用和ios本地应用编程的差异 ·创建一个工作台应用来测试贯穿整个学习过程的代码段
·理解ios应用的结构,比较通过objective-和javascript搭建对象的过程
·揭示你的代码如何启动ios应用并让它们准备就绪 ·学习ios内存管理,以及与javascrip程有所差异的objective-c指针和数据类型
·使用objective-和cocoa touch实现常见的javascript任务
作译者回到顶部↑
本书提供作译者介绍
DannyGoodman写了将近40本书和数以百计的在个人电脑以及消费性电子杂志上的文章。最近,他正在从事iPhone和iPod touch应用的开发工作,包括iFeltThat Earthquake、PhotoSize和BeaconAid-HF。
.. << 查看详细
.. << 查看详细
目录回到顶部↑
《ios 4 sdk入门给javascript程序员(英文影印版)》
preface
1. why go native?
using an app offline
more access to the hardware
more access to the software
what you lose
distribution
apple ios developer program
content
authoring platform choices
taking the plunge
2. welcome to the i0s sbk
hardware and os requirements
installing the sdk
about los developer programs
inside the sdk
viewing developer documentation
loading code samples
setting the project's base sdk
preface
1. why go native?
using an app offline
more access to the hardware
more access to the software
what you lose
distribution
apple ios developer program
content
authoring platform choices
taking the plunge
2. welcome to the i0s sbk
hardware and os requirements
installing the sdk
about los developer programs
inside the sdk
viewing developer documentation
loading code samples
setting the project's base sdk
前言回到顶部↑
You don't have to be an Apple fanboy or fangirl to give Apple Inc. credit for redefining mobile gadgetry and its surrounding industries. First the company used the iPod to reshape the music industry and strongly influence how we acquire and consume tunes.Just count the number of people wearing iPod-connected earbuds in a subway car.Then the iPhone rewrote the cellular telephone industry manual, while opening the world's eyes to the potential of being connected to the Internet nearly everywhere, all the time. It's happening again with the iPad, where electronic publishing is evolving fight before our eyes.
Although the iPhone was an early success with just the workable but limited set of Apple-supplied applications that came with the phone, programmers couldn't wait to get their hands on the platform. The first word that Apple let drop about third-party developers, however, landed with a bit of a thud: they were graciously allowed to create web apps. Sure, the iPhone's WebKit-based browser let creative HTML, CSS, and JavaScript programmers create far more than dull web pages, but the apps still faced frustrating limits compared to Apple's native apps.
It took some additional months, but Apple eventually released a genuine software development kit (SDK) to allow third-party programmers to create native applications for what was then called the iPhone OS. Part of Apple's task was also creating the App Store to distribute apps--yet another industry-transforming effort. Many existing Mac OS X developers rejoiced because the iPhone OS was derived from Mac OS X. The iPhone SDK was based on the same Xcode tools that Mac developers had been using for some time. The language of choice was Objective-C.
As a happy iPhone early adopter, I eagerly awaited the iPhone SDK. Unfortunately,despite my years of being a dedicated Mac user since 1984 and a scripter since 1987 and the HyperCard days, I had never done any Mac OS X programming. I didn't know much about C and next to nothing about Objective-C. Still, I thought perhaps my years of experience in JavaScript would be of some help. After all, at one time I even learned enough Java to write a small browser applet to demonstrate how JavaScript code in a web page can communicate with the applet. At least I knew what a compiler did.
When the iPhone SDK landed on my Mac, I was simply overwhelmed. The old meta-phor of trying to sip from a firehose definitely applied. The more I read Apple's early developer documentation, the more I felt as though I had to know a lot more than I knew just to understand the "getting started" texts. With JavaScript having been the most recent language acquisition for me (albeit back in late 1995), I looked for anything I could borrow from that experience to apply to iPhone app development. I'd see occasional glimmers, but I was basically flying blind, not knowing what I had to discard and what I could keep.
The SDK was evolving during that time as well. I'd read a tutorial here and there, but
I wasn't making much headway at first. Some tools, especially Interface Builder, felt incomplete to me. Frankly, I had a couple of false starts where I walked away until a future SDK version appeared. Finally, I reached a point that was "put up or shut up."After sticking with it and reading many of the documents many times, I was, indeed,getting tastes from the firehose. Working on iPhone development as a part-time effort over a three-month period, I managed to go from the starting line to submitting my first app to the App Store in January 2009.
Since then I've been monitoring the developer communities on both the native app and web app sides. I've even sat in online courses for web app developers to see what they're saying in the chat room. A lot of web app developers seem to look enviously to native iPhone and iPad development. I suspect many have gone through the same false starts that I did. And yet I know from my own experience that it is possible to make the transition from web app to native app developer if you know how to channel your JavaScript knowledge into what is now known as the iOS SDK environment.
What You Need to Start
I have written this book specifically for the web developer who is comfortable in the JavaScript language. Even if you use a bit of JavaScript to glue together apps from third-party JavaScript libraries and frameworks, you should be ready for this book. Unlike most entry-level iOS programming books, this one assumes that you have not neces-sarily worked in a compiled language before. You probably have little or no experience with C or Objective-C. But you do know what a string and an array are because you use them in your JavaScript work. I will be introducing you to the way Objective-C works by comparing and contrasting what you use in JavaScript. It's the kind of hand-holding that I wish I had when I started learning iPhone app development.
You will get more from this book if you are the adventurous type. By adventurous, I mean that you will follow the instructions throughout to try things for yourself. Along the way I will help you build an app called Workbench, where you will be able to play and learn by experimenting with little pieces of code here and there. Creating projects,editing files, and building apps is the only way to really get to know the SDK.
Of course, you'll need a Macinto~sh running Mac OS X version 10.6 (Snow Leopard) or later. I'll have more details about getting set up with hardware and SDK Software in Chapter 2.
What's in This Book
Perhaps because my programming knowledge has been completely self-taught over thedecades, this book does not follow what some might term traditional programming language training. First of all, you already come to the book with specialized knowledge.The goal of the book is to pick up where that knowledge leaves off and fill in the gaps with the new material. There's no doubt about it: there is a lot of new material for you.But I have tried to establish a learning progression that will make sense and keep you interested while you learn the decidedly unglamorous--but essential--parts of iOS programming.
Chapter 1 goes into detail about the differences between web app and native app pro-gramming for devices running iOS. It's not all roses for native app development, as you'll see, but I believe the positives outweigh the negatives. In Chapter 2, you will install the iOS SDK, inspect one of the sample apps, and run it on the iOS Simulator.Then in Chapter 3, I put you to work to create your first iPhone app--the Workbench app that you'll use throughout the rest of the book. The steps are intended to help you get more comfortable with Xcode and learn what it's like to work on an app in the environment.
In Chapter 4, you will use the Workbench app to build your first Objective-C object and compare the process against building the same object in JavaScript. You will spend a lot of time in Xcode. And if you've used JavaScript frameworks for your web app development, wait until you get a peek at the frameworks you'll be using in iOS app development.
The focus of Chapter 5 is understanding how the code you write commands an iOS device to launch your app and get it ready for a user to work with. In the process, you'll learn a great deal about how an app works. In fact, by the end of this chapter, you will add a second screen to Workbench and animatedly switch between the two.
Sometimes while learning new material, you have to take your medicine. That happens in Chapter 6, where you meet three programming concepts that are foreign to what you know from JavaScript: pointers, data typing, and memory management. There will be plenty of sample code for you to try in the Workbench app to learn these new concepts.
Objective-C is built atop the C language. There is still a bit of C that you should know to be more comfortable in the newer language. Chapter 7 shows you what you need to know from C. The good news is that a fair amount of it is identical to JavaScript.Hooray! And most of the esoterica isn't needed because it's all covered in more robust and friendly ways in Objective-C, as covered in Chapter 8. There you'll learn how Objective-C handles strings, arrays, and other data collections.
The final chapter, Chapter 9, is also the longest. It provides a catalog of programming asks you re accustomed to, but Implemented m the iOS SDK. Most of the jobs will be familiar to you--formatting numbers, performing date calculations, sorting arrays,working with user-entered text, having Ajax-like communications with a server, and even dragging an item around a screen. I don't expect you to learn and remember everything described in Chapter 9, but know what's there find how to find it when the need arises in your own iOS development.
Although the iPhone was an early success with just the workable but limited set of Apple-supplied applications that came with the phone, programmers couldn't wait to get their hands on the platform. The first word that Apple let drop about third-party developers, however, landed with a bit of a thud: they were graciously allowed to create web apps. Sure, the iPhone's WebKit-based browser let creative HTML, CSS, and JavaScript programmers create far more than dull web pages, but the apps still faced frustrating limits compared to Apple's native apps.
It took some additional months, but Apple eventually released a genuine software development kit (SDK) to allow third-party programmers to create native applications for what was then called the iPhone OS. Part of Apple's task was also creating the App Store to distribute apps--yet another industry-transforming effort. Many existing Mac OS X developers rejoiced because the iPhone OS was derived from Mac OS X. The iPhone SDK was based on the same Xcode tools that Mac developers had been using for some time. The language of choice was Objective-C.
As a happy iPhone early adopter, I eagerly awaited the iPhone SDK. Unfortunately,despite my years of being a dedicated Mac user since 1984 and a scripter since 1987 and the HyperCard days, I had never done any Mac OS X programming. I didn't know much about C and next to nothing about Objective-C. Still, I thought perhaps my years of experience in JavaScript would be of some help. After all, at one time I even learned enough Java to write a small browser applet to demonstrate how JavaScript code in a web page can communicate with the applet. At least I knew what a compiler did.
When the iPhone SDK landed on my Mac, I was simply overwhelmed. The old meta-phor of trying to sip from a firehose definitely applied. The more I read Apple's early developer documentation, the more I felt as though I had to know a lot more than I knew just to understand the "getting started" texts. With JavaScript having been the most recent language acquisition for me (albeit back in late 1995), I looked for anything I could borrow from that experience to apply to iPhone app development. I'd see occasional glimmers, but I was basically flying blind, not knowing what I had to discard and what I could keep.
The SDK was evolving during that time as well. I'd read a tutorial here and there, but
I wasn't making much headway at first. Some tools, especially Interface Builder, felt incomplete to me. Frankly, I had a couple of false starts where I walked away until a future SDK version appeared. Finally, I reached a point that was "put up or shut up."After sticking with it and reading many of the documents many times, I was, indeed,getting tastes from the firehose. Working on iPhone development as a part-time effort over a three-month period, I managed to go from the starting line to submitting my first app to the App Store in January 2009.
Since then I've been monitoring the developer communities on both the native app and web app sides. I've even sat in online courses for web app developers to see what they're saying in the chat room. A lot of web app developers seem to look enviously to native iPhone and iPad development. I suspect many have gone through the same false starts that I did. And yet I know from my own experience that it is possible to make the transition from web app to native app developer if you know how to channel your JavaScript knowledge into what is now known as the iOS SDK environment.
What You Need to Start
I have written this book specifically for the web developer who is comfortable in the JavaScript language. Even if you use a bit of JavaScript to glue together apps from third-party JavaScript libraries and frameworks, you should be ready for this book. Unlike most entry-level iOS programming books, this one assumes that you have not neces-sarily worked in a compiled language before. You probably have little or no experience with C or Objective-C. But you do know what a string and an array are because you use them in your JavaScript work. I will be introducing you to the way Objective-C works by comparing and contrasting what you use in JavaScript. It's the kind of hand-holding that I wish I had when I started learning iPhone app development.
You will get more from this book if you are the adventurous type. By adventurous, I mean that you will follow the instructions throughout to try things for yourself. Along the way I will help you build an app called Workbench, where you will be able to play and learn by experimenting with little pieces of code here and there. Creating projects,editing files, and building apps is the only way to really get to know the SDK.
Of course, you'll need a Macinto~sh running Mac OS X version 10.6 (Snow Leopard) or later. I'll have more details about getting set up with hardware and SDK Software in Chapter 2.
What's in This Book
Perhaps because my programming knowledge has been completely self-taught over thedecades, this book does not follow what some might term traditional programming language training. First of all, you already come to the book with specialized knowledge.The goal of the book is to pick up where that knowledge leaves off and fill in the gaps with the new material. There's no doubt about it: there is a lot of new material for you.But I have tried to establish a learning progression that will make sense and keep you interested while you learn the decidedly unglamorous--but essential--parts of iOS programming.
Chapter 1 goes into detail about the differences between web app and native app pro-gramming for devices running iOS. It's not all roses for native app development, as you'll see, but I believe the positives outweigh the negatives. In Chapter 2, you will install the iOS SDK, inspect one of the sample apps, and run it on the iOS Simulator.Then in Chapter 3, I put you to work to create your first iPhone app--the Workbench app that you'll use throughout the rest of the book. The steps are intended to help you get more comfortable with Xcode and learn what it's like to work on an app in the environment.
In Chapter 4, you will use the Workbench app to build your first Objective-C object and compare the process against building the same object in JavaScript. You will spend a lot of time in Xcode. And if you've used JavaScript frameworks for your web app development, wait until you get a peek at the frameworks you'll be using in iOS app development.
The focus of Chapter 5 is understanding how the code you write commands an iOS device to launch your app and get it ready for a user to work with. In the process, you'll learn a great deal about how an app works. In fact, by the end of this chapter, you will add a second screen to Workbench and animatedly switch between the two.
Sometimes while learning new material, you have to take your medicine. That happens in Chapter 6, where you meet three programming concepts that are foreign to what you know from JavaScript: pointers, data typing, and memory management. There will be plenty of sample code for you to try in the Workbench app to learn these new concepts.
Objective-C is built atop the C language. There is still a bit of C that you should know to be more comfortable in the newer language. Chapter 7 shows you what you need to know from C. The good news is that a fair amount of it is identical to JavaScript.Hooray! And most of the esoterica isn't needed because it's all covered in more robust and friendly ways in Objective-C, as covered in Chapter 8. There you'll learn how Objective-C handles strings, arrays, and other data collections.
The final chapter, Chapter 9, is also the longest. It provides a catalog of programming asks you re accustomed to, but Implemented m the iOS SDK. Most of the jobs will be familiar to you--formatting numbers, performing date calculations, sorting arrays,working with user-entered text, having Ajax-like communications with a server, and even dragging an item around a screen. I don't expect you to learn and remember everything described in Chapter 9, but know what's there find how to find it when the need arises in your own iOS development.
媒体评论回到顶部↑
“每一个有Web开发背景并且希望进入到本地应用编程的人都应该跟随Danny调查好的方法来学习这个平台。这是任何一个有经验的期待展开AppStore之旅的JavaScript程序员的最佳指南。”
——Todd Moore,WhiteNoise应用的创建者
——Todd Moore,WhiteNoise应用的创建者







点击看大图
加载中...

