1. Trang chủ
  2. » Công Nghệ Thông Tin

Praise for iPhone in Action pot

433 1,5K 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 433
Dung lượng 24,31 MB

Nội dung

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> [...]... provides you with a roadmap for the iPhone 4.0 SDK and points you in a direction to get more information The appendixes contain some additional information that didn’t fit with the flow of the main text Appendix A contains a list of SDK objects and what they do Appendix B features links for many websites of note for iPhone SDK programming Appendix C includes the current information on how to deploy... 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 Summary Bubble... colleagues for their support and assistance SHANNON would like to thank Christopher, who got this book started in the first place, and Brandon for taking on the revised edition Download from Wow! eBook about this book iPhone and iPad in Action is an introductory book, intended to teach the basics of iPhone SDK programming in a tutorial form It’s an updated revision of iPhone in Action, ... Recording, playing, and accessing video Summary 242 240 Graphics: Quartz, Core Animation, and OpenGL 13.1 13.2 An introduction to Quartz 2D The Quartz context 244 Drawing to a UIView 13.3 Drawing paths 246 ■ 244 Drawing to a bitmap 247 248 Finishing a path 249 Creating reusable paths Drawing rectangles 251 ■ 13.4 249 Setting the graphical state 251 Setting colors 252 Making transformations 253 Setting... links they have found, discussions 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... 328 Adding a map to an application 329 Adding the map using Interface Builder 329 Adding the map programmatically 330 Controlling the map 330 ■ ■ 17.3 17.4 Reverse geocoding 332 Annotating the map 334 Adding basic map annotations annotations 336 17.5 18 Summary 335 341 In- app purchasing using Store Kit 18.1 342 Setting up a sandbox testing environment Creating an iTunes test user 18.2 18.3 Adding custom... Creating a modal view 138 Data: actions, preferences, and files 8.1 8.2 136 Accepting user actions 140 Maintaining user preferences 139 141 Creating your own preferences 142 Using the system settings 147 8.3 Opening files 151 Accessing your bundle 152 Accessing other directories 153 Manipulating files 154 Filesaver: a UITextView example 155 ■ ■ 8.4 9 Summary 158 Data: advanced techniques 9.1 Using SQLite... 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 There’s no need for. .. ■ 12.3 Playing sounds manually 234 Initializing the AVAudioPlayer 235 The AVAudioPlayerDelegate 235 Controlling the AVAudioPlayer 236 ■ 12.4 Example: creating a simple audio recording/ playback application 237 Creating a view-based application 238 Adding the needed frameworks 238 Setting up the IBActions 238 Creating the interface 239 Setting up the audio recorder and implementing the IBActions 239... remembering According to research in cognitive science, the things people remember are things they discover during self-motivated exploration Although no one at Manning is a cognitive scientist, we are convinced that for learning to become permanent it must pass through stages of exploration, play, and, interestingly, retelling of what is being learned People understand and remember new things, which is . MANNING Brandon Trebitowski Christopher Allen Shannon Appelcline IN ACTION Revised edition of iPhone in Action Introduction to SDK Development Praise for. user actions 140 8.2 Maintaining user preferences 141 Creating your own preferences 142 Using the system settings 147 8.3 Opening files 151 Accessing

Ngày đăng: 22/03/2014, 20:20

TỪ KHÓA LIÊN QUAN