出版時(shí)間:2010-10 出版社:東南大學(xué)出版社 作者:史蒂文森 頁(yè)數(shù):396
Tag標(biāo)簽:無(wú)
內(nèi)容概要
為Mac、iPhone和iPad打造健壯的應(yīng)用程序,無(wú)論你是只有基本的編程技能,還是有多年的開(kāi)發(fā)經(jīng)驗(yàn)。在本書中,你將通過(guò)循序漸進(jìn)的教程、親身實(shí)踐的練習(xí)、簡(jiǎn)明扼要的范例,以及來(lái)自Cocoa專家的諄諄教誨,學(xué)會(huì)如何運(yùn)用Apple的Cocoa框架和lObiective—C語(yǔ)言。 《Cocoa與ObjectiVe—c:構(gòu)建與運(yùn)行》給你打下充分的理論基礎(chǔ),然后向你展示如何使用Apple的快速開(kāi)發(fā)工具——Xcode和InterlfaceBuilder,來(lái)開(kāi)發(fā)Cocoa應(yīng)用程序、管理用戶交互、創(chuàng)建很棒的UI等等。你將迅速獲得開(kāi)發(fā)高級(jí)軟件所需的經(jīng)驗(yàn),無(wú)論你是編程新手還是該平臺(tái)的入門用戶。
作者簡(jiǎn)介
Scott Stevenson從事Cocoa應(yīng)用開(kāi)發(fā)八年,此外還擁有六年相關(guān)教學(xué)經(jīng)驗(yàn)。他曾創(chuàng)建了風(fēng)靡一時(shí)的Mac編程博客Theocacao,并且于2003年接手Cocoa Dev Central,成為主筆和編輯。他在硅谷組織了多場(chǎng)Cocoa Heads會(huì)議,并發(fā)表演講。
書籍目錄
Preface1. Setup and First Run Download and Install Xcode Your First Application Create the Interface Run the Finished Application2. Thinking in Code: Basic C How Code Works How to Format Code Variables Types Constants Enumerated Types Typedefs Functions Declaring Functions Example: FirstProgram Displaying Values on the Command Line Compile and Run the Example Scope Static Variables Conditionals Example: ShoppingTrip Compile and Run Wrap Up3. Memory and Pointers: Advanced C Arrays Loops Text Strings Multidimensional Arrays Pointers The Purpose of Pointers Using Pointers Pointers and the const Keyword Dynamic Memory Strings and Dynamic Memory Returning Strings from Functions Arrays of Strings Example: AddressBook Compile and Run the AddressBook Example Structs Header Files Compile and Run the HeaderFileTest Example Create Files for the Song Struct Final Example4. Thinking in Objects Structs and Classes Designing Classes Accessors Inheritance Composition Object Lifetime Built-in Classes5. Basic Objective-C NSString Basics Using Methods Nested Method Calls Multi-Input Methods Accessors Dot Syntax Creating Objects Basic Memory Management Using Autorelease Directly Declaring a Class Add Methods Implementing a Class init dealloc Example: Photolnfo6. More Objective-C More on Memory Management The Life of an Instance Variable Copying Objects Class Name Prefixes Properties Property Options 64-Bit Objective-C Enabling 64-Bit Should I Use 64-Bit? All Further Examples Assume 64-Bit Categories Categories for Private Methods Introspection Protocols Dynamic Messaging Using Selectors to Call Methods Forwarding Messages Exceptions Example: DataCollector Some New Classes and Methods Create the Files Build and Run7. Foundation Value Classes NSString Ranges and Substrings Using NSString with C Types Comparing Strings for Equality Strings As File Paths Reading and Writing Files with Strings Mutability Advantages of Mutability Advantages of Immutability Core Foundation Memory Management Core Foundation Mutability Toll-Free Bridging Core Foundation Types As Properties Drawbacks of Core Foundation Types Open Source NSNumber CFNumberRef Cocoa Primitive Types NSDecimalNumber NSNumberFormatter When to Use Which Number Type NSData NSMutableData NSArray Fast Enumeration Blocks NSMutableArray CFArrayRef NSIndexSet NSDictionary NSMutableDictionary CFDictionaryRef NSSet NSMutableSet NSValue NSDate CFDateRef8. Basic C0ntr01s How to Use This Chapter Windows and Views Targets and Actions Buttons Declaring Action Methods Connecting Actions Menus Responder Chain Pop-up Buttons Sliders Text Fields Outlets Datasources Table View Datasource Methods Implementing Datasource Methods Bindings Key-Value Protocols Bindings for Simple Controls Bindings for Complex Controls Tips for Debugging Bindings9. Designing Applications Using MVC About This Project Window Controllers View Controllers Core Data Create the Project Files Create the Entities Add Attributes and Relationships Update the App Delegate Add the Quartz Framework Create the Window Controller Create the View Controllers Create the Managed Object Classes Create the User Interface Remove the Default Window Create the Main Window Interface Create the Browser Interface Create the Editor View Interface Create the List View Interface Run the Application Preparing for Release10. Custom Views and Drawing Basic Geometry Geometry Structs As Strings Geometry Structs As NSValues Cocoa View Coordinates Derived Rects Comparison Functions Basic Drawing NSColor Subclassing NSView Instantiate the View The Graphics Context Bezier Paths Drawing Polygons Drawing Curved Paths Images Loading Image Data Drawing Images in a View Shadows Add a Shadow to StyledlmageView Gradients Drawing a Gradient Background Drawing an Image Sheen, Refactoring View Code Why You Should Refactor Goals for Refactoring Refactored Header Refactored Implementation Test the Refactored Version Text Fonts Attributed Strings Add a Title to StyledlmageView Handling Mouse and Keyboard Events Keyboard Events Mouse Events Add Event Support to StyledImageView11. The Final Word The List Websites Last ThoughtIndex
章節(jié)摘錄
插圖:AcknowledgmentsMy education didn't follow the normal path. I taught myself how to program and learned how to run a business mostly by trial and error. In the end, I think this is the only option that would have worked for me, but it was possible only because of my extremely patient and understanding family: my morn, Peggy; my dad, Alan; and my sister, Jamie. You would not be reading this now if it was not for their support. There are so many people that have helped me in my work life, but there are a few that have had a direct impact on this book.Michael Lopp and Angela Muller were ongoing sources of encouragement and inspiration. This book first came into being over lunch when Michael mentioned something along the lines of “everyone wants an animal on the cover of their book,” referring to the iconic O'Reilly covers. By incredible coincidence, Brian from O'Reilly emailed me about two weeks later. Had Michael not made that comment, this might not have happened.I had world-class tech reviewers for this project: Joar Wingfors, Michael Jurewitz, Rob Rhyne, and Tim Triemstra. Joar, who I originally met through the tutorials I posted online, tirelessly reviewed an ever-changing book, provided a wealth of essential com- ments and suggestions, and even helped me fix some bugs in the code. He,s one of the most talented engineers I know, and I am thrilled to have been able to get his help on this.Though he wasn't involved in this project, I owe a lot to John Mora. He has an ability to look an impossibly large task in the face and just do it, despite the usual doubts about whether you know enough or have enough time. It is one of the most impressive traits I know of, and John has it in spades. Thankfully, I think some of that rubbed off on me over the 15 years I've known him.Thanks to Kip Krueger for patiently helping me figure out the low-level details of memory and offering pointers when I was learning C. His mentoring is the reason I'm able to teach these topics to you now.
媒體關(guān)注與評(píng)論
“我剛開(kāi)始在Mac上做開(kāi)發(fā)時(shí),就已是Scott的著作的讀者。這本書提供的建議十分雋永,必將有益于讀者。” ——Rob Rhyne技術(shù)評(píng)論家和Briefs開(kāi)發(fā)者
編輯推薦
《Cocoa與Objective-C:構(gòu)建與運(yùn)行(英文)(影印版)》:獲得C語(yǔ)言編程基礎(chǔ)技能的快速實(shí)踐導(dǎo)覽,學(xué)習(xí)如何使用Interface Builder快速設(shè)計(jì)并構(gòu)建應(yīng)用的用戶界面原型,通過(guò)創(chuàng)建對(duì)象和學(xué)習(xí)內(nèi)存管理,開(kāi)始使用Objective-C,學(xué)習(xí)用于對(duì)象之間共享數(shù)據(jù)的模型-視圖-控制器(MVC)方法,理解基礎(chǔ)值類,這是Cocoa存儲(chǔ)一般數(shù)據(jù)類型的健壯API, 熟悉Apple的圖形框架,并且學(xué)習(xí)如何用AppKit制作定制視圖。
圖書封面
圖書標(biāo)簽Tags
無(wú)
評(píng)論、評(píng)分、閱讀與下載