Cocoa.Programming.for.Mac.OS.X.4th.Edition

所需积分/C币:9 2014-08-30 09:50:26 30.35MB PDF
0
收藏 收藏
举报

Cocoa.Programming.for.Mac.OS.X.4th.Edition original version
COCOAB PROGRAMMING FOR MACO OS X FOURTH EDITION Aaron Hillegass Adam preble ÷ Addison- Wesley Upper Saddle river,NJ· Boston· Indianapolis· San francisco New York· Toronto· Montreal· London· Munich· Paris· Madrid Capetown· Sydney· Tokyo· Singapore· Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed a trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim the designations have been printed with initial capital letters or in all capitals The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions no liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact U.S. Corporate and Government sales (800)382-3419 corpsales@pearsontechgroup.com For sales outside the United States, please contact International sales international@pearson.com Visit us on the web informit com/aw Library of Congress Cataloging-in-Publication Data Hillegass, Aaron Cocoa programming for Mac Os X/ Aaron Hillegass, Adam Preble,4th ed Includes index isBn 978-0-321-77408-8(pbk: alk. paper Cocoa(Application development environment)2. Operating systems (Computers)3. Mac Os.4. Macintosh(C Computer-Programming. I. Preble, Adam. II. Title QA76.76063H571452012 005.268-dc23 2011034459 Copyright o 2012 Pearson Education, Inc. 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 retrieva system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, InC, Permissions Department, One Lake Street, Upper Saddle river, New Jersey 07458, or you may fax your request to(201)236-3290 ISBN-13:978-0-321-77408-8 ISBN-10 0-321-77408-6 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana First printing, November 2011 For Aaron 's sons. Walden and or For Adam's daughter, aimee CONTENTS Preface Acknowledgments∴.∴……∴……∴………∴……..xxi Chapter 1 Cocoa: What Is It? A Little history Tools anguage 4 Objects, Classes, Methods, and Messages Frameworks,,,,,,,,,,,,,,,,,,,,,,,, How to read this book Typographical conventions Common mistakes How to learn hapter 2 Let's Get Started 11 n xcode Create a New project.............. The main function In Interface Builder The Utility al 16 The blank winde 16 Lay out the interfa 17 The dock 20 Create a class 20 Create an Instance 22 Make Connections 22 A Look at obje 25 Types and Constants in Objective-C.............. 26 00 ok at the header file 26 Edit the Implementation File Build and run .28 awake from Nib ...,,,,,,,,,,,,..,,30 Documentation What have You done? .31 Chronology of an application .32 Chapter3 Objective-C∴………… 。,。,,,35 Creating and Using Instances 35 Using Existing Clas 37 Sending Messages to nil.∴∴∴ NSObjec, NSArray, NSMutableArray, and NSString∴……43 “ Inherits fron” versus“Uses”or“ Knows about” Creating Your Own Classes reating the lottery Entry c 49 Changing mainm 51 Implementing a description Method 52 Writing In 55 Initializers with arguments ...,,,,,,,,,,,,,.,,,56 The debugger∴. What have you done? 63 Meet the Static Analyzer 63 For the more curious: How Does Messaging Work? hallenge Chapter 4 Memory management Living with Manual reference Counting.…… 9 k-Free le 70 de realloc 72 Autoreleasing objects The Retain-Count Rules ...................................76 Accessor Methods Living with arc 80 Strong refe 81 Weak references 81 arc Odds and er 82 CONTENTS Chapter 5 Target/Action ,.83 Some commonly used Subclasses of nscontrol 85 NSButton .85 NSSlider 8e NSTextfield 87 Start the SpeakLine example 9 Lay Out the Xib file ..90 Making Connections in Interface Builder 91 Implementing the SpeakLineAppDelegate Class..........94 For the More Curious: Setting the Target Programmatically ..........96 Challe 96 Debugging hints Chapter 6 Helper Objects 99 Delegates 100 The nstable view and its data Source ...104 Speaklineappdelegate interface File Lay out the user Interface..................107 Make connections ,109 Edit speaklineappdelegate m 110 Common errors in Implementing a Delegate∴……112 Many objects have delegates............ For the more Curious: How Delegates Work 113 Make a del legate 114 Challenge: Make a Data Source................. 114 hapter 7 Key-Value Coding and Key-value Observing 117 Key-Value Coding 117 Bindings 119 Key-Value Observing…… ,,,,,,,,,,,120 Making Keys Observable 21 Properties ..124 Attributes of a property 125 For the More Curious: Key Paths ,,,,,126 For the More Curious: Key-Value Observing 127 Chapter 8 NSArray Controller ..........................129 Starting the RaiseMan Application 130 RMDocument xib 134

...展开详情
试读 127P Cocoa.Programming.for.Mac.OS.X.4th.Edition
立即下载 低至0.43元/次 身份认证VIP会员低至7折
抢沙发
一个资源只可评论一次,评论内容不能少于5个字
上传资源赚积分or赚钱
    最新推荐
    Cocoa.Programming.for.Mac.OS.X.4th.Edition 9积分/C币 立即下载
    1/127
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第1页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第2页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第3页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第4页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第5页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第6页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第7页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第8页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第9页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第10页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第11页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第12页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第13页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第14页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第15页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第16页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第17页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第18页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第19页
    Cocoa.Programming.for.Mac.OS.X.4th.Edition第20页

    试读结束, 可继续阅读

    9积分/C币 立即下载 >