Tài liệu iPhone and iPad in Action: Introduction to SDK Development docx

433 6.1K 2
Tài liệu iPhone and iPad in Action: Introduction to SDK Development docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

MANNING Brandon Trebitowski Christopher Allen Shannon Appelcline IN ACTION Revised edition of iPhone in Action Introduction to SDK Development Praise for iPhone in Action …iPhone in Action is another smash hit by Manning Publications. Whether you are a novice programmer or an advanced programmer new to the iPhone platform, you are going to finish this book feeling ready to take on the world. —Panah Rad, iPhoneAppsFinder.com If I were teaching a class on the basics of developing for Apple’s new mobile platform, I would def- initely use this as the textbook iPhone in Action is a complete primer to iPhone development. —Victor Agreda, Jr., The Unofficial Apple Weblog (TUAW) well-suited for existing programmers who want comprehensive coverage of the iPhone platform, the development of webapps, and the key concepts in developing native apps with the SDK along with examples. —Peter Cooper, Mobile Orchard …excels at providing detailed, organized, and clear information on the development particular- ities of the iPhone iPhone in Action is the must-have book for developers looking to enter the realm of iPhone development. —Cody Overcash, Founder, ModMyi.com This book is invaluable for beginners because it shows all the possibilities for both web and SDK and it introduces all the key topics—something no other single title does. Experts will want this title too for the detailed web development topics. —Mark Johnson, reader There is no other iPhone title that has such great coverage of both web and SDK topics under one roof, providing a well-rounded developer education. —Vladimir Pasman, Cocoacast.com Download from Wow! eBook <www.wowebook.com> Download from Wow! eBook <www.wowebook.com> iPhone and iPad in Action INTRODUCTION TO SDK DEVELOPMENT BRANDON TREBITOWSKI CHRISTOPHER ALLEN SHANNON APPELCLINE Revised Edition of iPhone in Action MANNING Greenwich (74° w. long.) Download from Wow! eBook <www.wowebook.com> For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 180 Broad St. Suite 1323 Stamford, CT 06901 Email: orders@manning.com ©2011 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editor: Katharine Osborne 180 Broad St. Copyeditor: Tiffany Taylor Suite 1323 Proofreader: Katie Tennant Stamford, CT 06901 Typesetter: Dottie Marsico Cover designer: Marija Tudor ISBN 978-1-935182-58-0 Printed in the United States of America 12 34567 8910– MAL–15 141312 1110 Download from Wow! eBook <www.wowebook.com> v brief contents 1 ■ Introducing the iPhone and iPad 1 2 ■ Learning Objective-C and the iPhone OS SDK 13 3 ■ Using Xcode 36 4 ■ Using Interface Builder 53 5 ■ Creating basic view controllers 68 6 ■ Monitoring events and actions 87 7 ■ Creating advanced view controllers 111 8 ■ Data: actions, preferences, and files 139 9 ■ Data: advanced techniques 159 10 ■ Positioning: accelerometers, location, and the compass 188 11 ■ Media: images and the camera 210 12 ■ Media: audio and recording 224 13 ■ Graphics: Quartz, Core Animation, and OpenGL 243 14 ■ The web: web views and internet protocols 271 15 ■ Peer-to-peer connections using Game Kit 295 16 ■ Push notification services 316 17 ■ The Map Kit framework 328 18 ■ In-app purchasing using Store Kit 342 19 ■ iPhone SDK enhancements 357 Download from Wow! eBook <www.wowebook.com> Download from Wow! eBook <www.wowebook.com> vii contents preface xvii acknowledgments xviii about this book xx 1 Introducing the iPhone and iPad 1 1.1 A bit of history 2 1.2 All for one and one for all: the iPhone OS platform 2 1.3 Core hardware specifications 3 The iPhone 4 ■ The iPad 4 ■ The iPod Touch 4 iPhone and iPad input and output specifications 5 iPhone and iPad network specifications 5 ■ iPhone OS browser specifications 6 ■ Mobile web standards 8 Other hardware features 8 1.4 How the iPhone and iPad are unique 9 1.5 Understanding iPhone and iPad touch interaction 11 1.6 Summary 12 2 Learning Objective-C and the iPhone OS SDK 13 2.1 Getting ready for the SDK 14 Installing the SDK 14 ■ The anatomy of the SDK 15 Download from Wow! eBook <www.wowebook.com> CONTENTSviii 2.2 Introducing Objective-C 17 The big picture 17 ■ The message 18 ■ Class definition 20 Properties 22 ■ Other compiler directives 24 ■ Categories and protocols 24 ■ Wrapping up Objective-C 25 2.3 Introducing the iPhone OS 26 The anatomy of the iPhone OS 26 ■ The object hierarchy of the iPhone OS 27 ■ Windows and views 28 2.4 The iPhone OS’s methods 30 Object creation 30 ■ Memory management 32 ■ Event response 33 ■ Lifecycle management 34 2.5 Summary 35 3 Using Xcode 36 3.1 Introducing Xcode 36 The anatomy of Xcode 37 ■ Compiling and executing in Xcode 38 3.2 Creating a first iPhone project in Xcode: Hello, World! 39 Understanding main.m 39 ■ Understanding the application delegate 40 ■ Writing Hello, World! 42 3.3 Creating a first iPad project in Xcode: Hello, World! 44 Writing Hello, World! 45 3.4 Creating a new class in Xcode 45 The new class how-to 46 ■ The header file 46 ■ The source code file 47 ■ Linking it in 49 3.5 Other Xcode functionality 49 Adding frameworks with Xcode 49 ■ Using alternate templates with Xcode 50 ■ Xcode tips and tricks 51 3.6 Summary 52 4 Using Interface Builder 53 4.1 An introduction to Interface Builder 54 The anatomy of Interface Builder 54 ■ Simulating in Interface Builder 56 4.2 A first project in Interface Builder: pictures and the web 57 Creating new objects 57 ■ Manipulating objects graphically 58 Using the inspector window 58 ■ Working with pictures 60 Download from Wow! eBook <www.wowebook.com> CONTENTS ix 4.3 Building connections in Interface Builder 61 Declaring an IBOutlet 62 ■ Connecting an object 62 Coding with IBOutlets 63 4.4 Other Interface Builder functionality 65 Building other connections 65 ■ Creating external objects 65 Initializing Interface Builder objects 66 ■ Accessing .xib files 66 Creating new .xib files 67 4.5 Summary 67 5 Creating basic view controllers 68 5.1 The view controller family 69 5.2 The standard view controller 70 The anatomy of a view controller 70 ■ Creating a view controller 71 ■ Creating another view controller 71 ■ Building up a view controller interface 72 ■ Using your view controller 73 5.3 The table view controller 78 The anatomy of a table view controller 78 ■ Creating a table view controller 78 ■ Building up a table interface 80 ■ Using your table view controller 85 5.4 Summary 85 6 Monitoring events and actions 87 6.1 An introduction to events 88 The responder chain 88 ■ Touches and events 89 6.2 A touching example: the event reporter 91 Setting things up in Interface Builder 92 ■ Preparing a view for touches 93 ■ Controlling your events 95 6.3 Other event functionality 97 Regulating events 97 ■ Other event methods and properties 98 6.4 An introduction to actions 99 The UIControl object 99 ■ Control events and actions 99 Using addTarget:action:forControlEvents: 101 6.5 Adding a button to an application 102 Using addTarget:action:forControlEvents: with a button 102 Using an IBAction with a button 103 6.6 Other action functionality 104 Accepting text input with UITextField 104 ■ Allowing value selection with UISlider 106 ■ A TextField/Slider mashup 106 Actions made easy 108 ■ Actions in use 108 Download from Wow! eBook <www.wowebook.com> [...]... for cut and paste, a ubiquitous feature for any computer produced in the last couple of decades In addition to resulting in some changes to existing interfaces, the input interface also introduces a number of new touches (one-fingered input) and gestures (twofingered input), as described in table 1.4 Table 1.4 iPhone and iPad touches and gestures allow you to accept user input in new ways Input Type... Introducing the iPhone and iPad This chapter covers Understanding Apple’s iPhone and iPad technology Examining the iPhone and iPad specifications Highlighting what makes the iPhone and iPad unique There is no doubt that Apple has completely altered the mobile computing paradigm with its introduction of the iPhone and iPad A sleek touchscreen interface almost completely devoid of actual buttons physically... about “missing classes” that we didn’t cover in this book, and occasional articles of more weight And we continue to host Christopher’s original iPhone forum on web development, which you can find at http://www.iphonewebdev.com About the title By combining introductions, overviews, and how -to examples, the In Action books are designed to help learning and remembering According to research in cognitive... easy to use and provided numerous bells and whistles, from stock and weather reports to always-on internet access Sales reflected the frenzied interest Apple sold 270,000 iPhones in 2 days and topped a million units in just a month and a half Interest in the iPhone continued to grow Apple’s July 11, 2008, release of the new 3G iPhone and its public deployment of the iPhone software development kit (SDK) ... direction to cause scrolling Another interesting element of the touchscreen is shown off by the fact that a finger isn’t singular Recall that the iPhone and iPad touchscreens are multitouch This allows users to manipulate the device with multifinger gestures Pinch-zooming is one such example To zoom in to a page, you tap two fingers on the page and then push them apart; to zoom out you similarly push them together... is in print Brandon frequently posts tutorials and code snippets on his iPhone development blog at http://icodeblog.com He is also very active on Twitter and available to answer most of your iPhone and iPad development questions Find him on Twitter at http:// twitter.com/brandontreb Christopher and Shannon’s main hangout is http://iphoneinaction.manning com This blog contains the newest noteworthy links... part of the story By looking deeper into the iPhone s and iPad s input and output, network, and other capabilities, you’ll discover what makes them truly innovative computing platforms The input and output capabilities of the iPhone and iPad feature cutting-edge functionality that determines how developers program for the platform Input is conducted through a multitouch-capable capacitive touchscreen... revision of iPhone in Action, which first appeared in 2008 We encourage you to read it straight through, from chapter 1 to 19 This will introduce the platform, how to program for the iPhone and iPad, and step you through the entire process in turn The audience We’ve done our best to make this book accessible to everyone who is interested in writing native programs for the iPhone and iPad We think it will... of content, and the navigation view controller adds hierarchy to tables Chapter 8 opens the SDK toolkit by talking about data This includes user input, such as actions and preferences; data storage, such as files; and tools that combine input and storage, such as the devices’ address book Chapter 9 goes into more advanced data strategies In this chapter, you learn how to store complex data in an SQLite... topics The purchase of iPhone and iPad in Action includes free access to a private web forum run by Manning Publications, where you can post comments about the book, ask technical questions, and receive help from the authors and from other users To access the forum and subscribe to it, point your web browser to http://www.manning com/iPhoneandiPadinAction The Author Online forum and the archives of previous . <www.wowebook.com> iPhone and iPad in Action INTRODUCTION TO SDK DEVELOPMENT BRANDON TREBITOWSKI CHRISTOPHER ALLEN SHANNON APPELCLINE Revised Edition of iPhone in Action MANNING Greenwich. MANNING Brandon Trebitowski Christopher Allen Shannon Appelcline IN ACTION Revised edition of iPhone in Action Introduction to SDK Development Praise

Ngày đăng: 12/02/2014, 20:20

Từ khóa liên quan

Mục lục

  • iPhone and iPad

  • brief contents

  • contents

  • preface

  • acknowledgments

  • about this book

    • The audience

    • Roadmap

    • Code conventions and downloads

    • Software requirements

    • Author Online

    • About the title

    • About the cover illustration

    • Chapter 1 Introducing the iPhone and iPad

      • 1.1 A bit of history

      • 1.2 All for one and one for all: the iPhone OS platform

      • 1.3 Core hardware specifications

        • 1.3.1 The iPhone

        • 1.3.2 The iPad

        • 1.3.3 The iPod Touch

        • 1.3.4 iPhone and iPad input and output specifications

        • 1.3.5 iPhone and iPad network specifications

        • 1.3.6 iPhone OS browser specifications

Tài liệu cùng người dùng

Tài liệu liên quan