IOS编程第6版 英文版 pdf
iOS Programming: The big Nerd ranch Guide by Christian Keur and Aaron Hillegass Copyright o 2016 Big Nerd Ranch, LLC All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means electronic, mechanical, photocopying, recording, or likewise. For information regarding permisSions, contact Big Nerd Ranch, LLC 200 Arizona ave ne Atlanta ga 30307 (770)817-6373 http://www.bignerdranch.com/ book-comments@bignerdranch.com The 10-gallon hat with propeller logo is a trademark of Big Nerd anch, LLC Exclusive worldwide distribution of the english edition of this book by Pearson Technology group 800 East 96th Street Indianapolis, iN 46240 USA http://www.informit.com The authors and publisher have taken care in writing and printing this book but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions no liabi lity is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. App Store, Apple, Cocoa, Co coa Touch, Finder, Instruments, iCloud, iPad, iPhone, iPod, iPod touch, iTunes, Keychain, Mac, Mac OS, Multi-Touch, Objective-C, OS X, Quartz, Retina, Safari, and Xcode are trademarks of apple, Inc registered in the u.s. and other countries Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademar k claim, the designations have been printed with initial capital letters or in all capitals Print IsBn-10 013468964X Print isbn-139780134689647 Sixth edition, first printing, December 2016 Release K.6. 1.1 Acknowledgments While our names appear on the cover, many people helped make this book a reality. We would like to take this chance to thank them First and foremost we would like to thank Joe Conway for his work on the earlier editions of this book. he authored the first three editions and contributed greatly to the fourth edition as well. Many of the words in this book are still his, and for that, we are very grateful Juan Pablo Claude wrote some of the content and contributed his expertise and opinions to make this book even better. His work is greatly appreciated A couple other people went above and beyond with their help on this book. They are Mikey Ward and Chris morris The other instructors who teach the iOS Bootcamp fed us a never-ending stream of suggestions and corrections. They are Ben Scheirman, Bolot Kerimbaev, Brian hardy, Chris morris, JJ Manton, John gallagher, Jonathan blocksom, Joseph Dixon, Juan Pablo Claude, Mark Dalrymple, Matt Bezark, Matt Mathias, Mike Zornek, Mikey Ward, Pouria Almassi, Robert edwards, Rod Strougo, Scott Ritchie, Step Christopher, Thomas Ward TJ USiyan, Tom Harrington, and Zachary Waldowski. These instructors were often aided by their students in finding book errata, so many thanks are due to all the students who attend the ios Bootcamp Thanks to all of the employees at Big Nerd ranch who helped review the book, provided suggestions, and found errata Our tireless editor, Elizabeth Holaday, took our distracted mumblings and made them into readable prose Anna Bentley and Simone Payment jumped in to provide copyediting and proofing Ellie Volckhausen designed the cover. the photo is of the bottom bracket of a bicycle frame) Chrisloperatintelligentenglish.comdesignedandproducedtheprintandebook versions of the book The amazing team at Pearson Technology group patiently guided us through the business end of book publishing The final and most important thanks goes to our students whose questions inspired us to write this book and whose frustrations inspired us to make it clear and comprehensible Table of contents Introduction Prerequisites What Has Changed in the Sixth Edition? Our Teaching philosophy How to use this book Using an eBook How This book Is organized Style choices Typographical Conventions Necessary Hardware and Software 1.A Simple ioS Application Creating an Xcode project Model-view-Controller Designing quiz Interface builder Building the Interface Creating view objects Configuring view objects Running on the simulator A brief introduction to Auto Layout Making connections Creating the Model layer mplementing action methods Loading the first question Building the Finished Application Application icons Launch screen The swift language rift pes in Swi. sing Standard Types Inferring types Specifying types literals and subscripting Initializers Properties Instance methods Optionals Subscripting dictionaries Loops and String Interpolation Enumerations and the switch statement Enumerations and raw values Exploring Apple's swift Documentation 3. Views and the View hierarchy View basics 工 he view hierarchy Creating a New project Views and frames Customizing the labels The Auto Layout System The alignment rectangle and layout attributes Constraints Adding constraints in interface builder Intrinsic content size Misplaced views Adding more constraints Bronze Challenge: More Auto Layout Practice 4. Text Input and delegation Text editing Keyboard attributes Responding to text field changes Dismissing the keyboard Implementing the temperature conversion Number formatters Delegation Conforming to a protoco Using a delegate More on protocols Bronze challenge: Disallow Alphabetic Characters 5. View Controllers TheV iew of aV iew controller Setting the Initial view Controller UITabBar Controller Tab bar items Loaded and Appearing views Accessing subviews Interacting with view Controllers and Their views Silver Challenge: Dark Mode For the More Curious: Retina display 6. Programmatic Views Creating a View Programmatically Programmatic Constraints Anchors Activating constraints Layout guides Margins Explicit constraints Programmatic Controls Bronze challenge: Another Tab Silver challenge: User's Location Gold Challenge: Dropping Pins For the more curious: NSAutoresizing Mas kLayoutConstraint 7. Localization Internationalization Formatters Base internationalization Preparing for localization Localization NSLocalized String and strings tables Bronze challenge: Another localization For the more curious: bundle,s role in internationalization For the More Curious: Importing and exporting aS XLIFF 8. Controlling Animations Basic animations Closures Another label Animation Completion Animating constraints Timing Functions Bronze challenge: Spring Animations Silver Challenge: Layout Guides 9. Debugging A Buggy project Debugging Basics Interpreting console messages Fixing the first bug Caveman debugging The Xcode Debugger LLDB Setting breakpoints Stepping through code The lldb console 10. UITable view and uitable viewController Beginning the Homepwner Application UITable viewController Subclassing uitable view Controller Creating the Item Class Custom initializers UITableview's data Source Giving the controller access to the store Implementing data source methods UITable viewcells Creating and retrieving uitable view Cells Reusing uitable viewcells Content insets Bronze challenge: Sections Silver challenge: Constant Rows Gold Challenge: Customizing the Table 11. Editing UITable View Editing mode Adding rows Deleting rows Moving rows Displaying user alerts Design Patterns Bronze Challenge: Renaming the Delete Button Silver Challenge: Preventing Reordering Gold Challenge: Really preventing reordering 12. Subclassing UITable viewCell Creating Item Cell Exposing the Properties of ItemCell Using Item Cell Dynamic Cell Heights Dynamic fype Responding to user changes Bronze Challenge: Cell Colors 13. Stack views Using UIStack view Implicit constraints Stack view distribution Nested stack views Stack view spacing Segues Hooking up the content Passing data Around Bronze challenge: More Stack views 14. UINavigation Controller UINavigation Controller Navigating with UINavigation controller Appearing and Disappearing views Dismissing the Keyboard Event handling basics Dismissing by - pressing the return key Dismissing by tapping elsewhere
用户评论