Learn Objective C for Java Developers 1st Edition James Bucanek (Auth.) - The ebook in PDF and DOCX formats is ready for download
Learn Objective C for Java Developers 1st Edition James Bucanek (Auth.) - The ebook in PDF and DOCX formats is ready for download
https://ebookfinal.com/download/jasperreports-reporting-for-java-
developers-1st-edition-david-heffelfinger/
https://ebookfinal.com/download/learning-cocoa-with-objective-c-2nd-
edition-james-duncan-davidson/
https://ebookfinal.com/download/learn-java-for-web-development-modern-
java-web-development-1st-edition-vishal-layka/
https://ebookfinal.com/download/beginning-xcode-programmer-to-
programmer-1st-edition-james-bucanek/
Learn Java Fundamentals A Primer for Java Development and
Programming 1st Edition Jeff Friesen
https://ebookfinal.com/download/learn-java-fundamentals-a-primer-for-
java-development-and-programming-1st-edition-jeff-friesen/
https://ebookfinal.com/download/effective-unit-testing-a-guide-for-
java-developers-1st-edition-lasse-koskela/
https://ebookfinal.com/download/objective-c-phrasebook-2nd-ed-edition-
david-chisnall/
https://ebookfinal.com/download/learn-java-in-a-weekend-1st-edition-
joseph-p-russell/
https://ebookfinal.com/download/microservices-for-java-developers-a-
hands-on-introduction-to-frameworks-and-containers-first-edition-
edition-posta/
Learn Objective C for Java Developers 1st Edition James
Bucanek (Auth.) Digital Instant Download
Author(s): James Bucanek (auth.)
ISBN(s): 9781430223702, 1430223707
Edition: 1
File Details: PDF, 4.01 MB
Year: 2009
Language: english
■ CONTENTS
Learn Objective-C
for Java Developers
■■■
James Bucanek
xxv
Learn Objective-C for Java Developers
Copyright © 2009 by James Bucanek
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information storage
or retrieval system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2369-6
ISBN-13 (electronic): 978-1-4302-2370-2
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit
of the trademark owner, with no intention of infringement of the trademark.
Lead Editors: Clay Andres, Douglas Pundick
Technical Reviewer: Evan DiBiase
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham,
Tony Campbell, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman,
Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick,
Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Project Manager: Kylie Johnston
Copy Editor: Elizabeth Berry
Compositor: Lynn L’Heureux
Indexer: Ann Rogers/Ron Strauss
Artist: April Milne
Cover Designer: Anna Ishchenko
Manufacturing Director: Michael Short
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th
Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-
ny@springer-sbm.com, or visit http://www.springeronline.com.
For information on translations, please e-mail info@apress.com, or visit
http://www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional
use. eBook versions and licenses are also available for most titles. For more information, reference
our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales.
The information in this book is distributed on an “as is” basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have
any liability to any person or entity with respect to any loss or damage caused or alleged to be
caused directly or indirectly by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com.
ii
■ CONTENTS AT A GLANCE
iii
■ CONTENTS
Contents at a Glance
PART 1 ■ ■ ■ Language
Chapter 1: Introduction ............................................................................................. 3
Chapter 2: Java and C: Key Differences ................................................................... 11
Chapter 3: Welcome to Objective-C ........................................................................ 27
Chapter 4: Creating an Xcode Project ..................................................................... 55
Chapter 5: Exploring Protocols and Categories ...................................................... 75
Chapter 6: Sending Messages .................................................................................. 87
Chapter 7: Making Friends with nil ....................................................................... 103
iv
■ CONTENTS AT A GLANCE
v
■ CONTENTS AT A GLANCE
Contents
About the Author ........................................................................................................xxi
About the Technical Reviewer ................................................................................. xxii
Acknowledgments ................................................................................................... xxiii
Introduction ................................................................................................................xiv
PART 1 ■ ■ ■ Language
Chapter 1: Introduction ............................................................................................. 3
What is Objective-C? ................................................................................................. 3
History ................................................................................................................... 4
A Modern Object-Oriented Language ................................................................. 4
State of the Art Compiler ...................................................................................... 5
Performance .......................................................................................................... 5
Dynamism ............................................................................................................. 5
Developer Productivity......................................................................................... 8
Learning a New Language ........................................................................................ 8
Terminology and Culture Shock .............................................................................. 9
Defining Better ........................................................................................................ 10
Summary ................................................................................................................. 10
Chapter 2: Java and C: Key Differences ................................................................... 11
Primitive Types ....................................................................................................... 11
Constants ................................................................................................................. 14
Typedefs .................................................................................................................. 15
Pointers .................................................................................................................... 15
Structures ................................................................................................................ 16
Object References ................................................................................................... 17
Arrays ....................................................................................................................... 18
static ......................................................................................................................... 19
Functions ................................................................................................................. 20
extern ....................................................................................................................... 20
vii
■ CONTENTS
Preprocessor............................................................................................................ 21
#include and #import ......................................................................................... 21
#define ................................................................................................................. 22
#if 23
Initializing Automatic Variables ............................................................................ 24
Labels: break, continue, and goto.......................................................................... 24
Summary ................................................................................................................. 26
Chapter 3: Welcome to Objective-C ........................................................................ 27
Defining an Objective-C Class ............................................................................... 27
Object Pointers........................................................................................................ 29
Sending Messages ................................................................................................... 30
Naming Methods .................................................................................................... 31
Parameter and Return Types ................................................................................. 33
Method Selectors .................................................................................................... 34
Instance Variables ................................................................................................... 34
isa35
Properties ............................................................................................................ 35
Property Attributes ............................................................................................. 38
Overriding Properties ............................................................................................. 40
Accessing Properties ............................................................................................... 40
Scope........................................................................................................................ 41
Class Name Scope ............................................................................................... 41
Instance Variable Scope ..................................................................................... 41
Method Scope ..................................................................................................... 42
Forward @class Directive ....................................................................................... 43
self and super .......................................................................................................... 44
Class Methods ......................................................................................................... 45
Constructing Objects .............................................................................................. 47
Writing an init Method ....................................................................................... 49
Chaining Initializers ........................................................................................... 50
Designated Initializer ......................................................................................... 52
Convenience Constructors ................................................................................ 52
Destructors .............................................................................................................. 53
What’s Missing?....................................................................................................... 54
Chapter 4: Creating an Xcode Project ..................................................................... 55
Download the Project ............................................................................................. 55
viii
■ CONTENTS
Creating a Project.................................................................................................... 56
Getting Started ........................................................................................................ 58
Designing the Application...................................................................................... 59
Designing the User Interface ............................................................................. 61
Adding a Controller ............................................................................................ 64
Making a Binding ................................................................................................ 65
KVC .................................................................................................................. 66
KVO .................................................................................................................. 67
Controllers ....................................................................................................... 67
Bindings ........................................................................................................... 67
Adding an Array Controller ................................................................................ 67
Getting Down to Business ...................................................................................... 68
Debugging Your Application.................................................................................. 72
Creating Sandbox Applications ............................................................................. 73
Summary ................................................................................................................. 74
Chapter 5: Exploring Protocols and Categories ...................................................... 75
Protocols .................................................................................................................. 75
Informal Protocol .................................................................................................... 77
Combining Formal and Informal Protocols ......................................................... 78
Categories ................................................................................................................ 79
Using Categories for Organization .................................................................... 81
Hiding Methods .................................................................................................. 81
Augmenting Foreign Classes.............................................................................. 82
Extensions ........................................................................................................... 84
Summary ................................................................................................................. 85
Chapter 6: Sending Messages .................................................................................. 87
Compiling Messages ............................................................................................... 88
Undeclared Methods .......................................................................................... 88
Ambiguous Methods .......................................................................................... 89
Coercion .............................................................................................................. 90
Sending Messages Programmatically.................................................................... 90
Immediate Messages .......................................................................................... 91
Deferred Messages .............................................................................................. 92
Object-Oriented Method Invocation .................................................................... 94
Calling Methods Directly........................................................................................ 96
ix
■ CONTENTS
x
■ CONTENTS
xi
■ CONTENTS
xii
■ CONTENTS
xiii
■ CONTENTS
xiv
■ CONTENTS
xv
■ CONTENTS
xvi
■ CONTENTS
Scaling............................................................................................................ 358
Bindings ................................................................................................................. 358
Interface Builder ................................................................................................... 360
NIB Documents ................................................................................................ 361
The NIB Document Window............................................................................ 361
Object Properties .............................................................................................. 361
Placeholder Objects .......................................................................................... 362
Connections ...................................................................................................... 363
Outlets............................................................................................................ 363
Actions ........................................................................................................... 364
Bindings ......................................................................................................... 365
Owner Object .................................................................................................... 367
Custom Objects ................................................................................................. 367
Object Instantiation .......................................................................................... 369
NIB Object Initialization .................................................................................. 369
Views ...................................................................................................................... 369
View Geometry .................................................................................................. 372
Coordinate Points ......................................................................................... 372
Coordinate System........................................................................................ 373
Pen Orientation ............................................................................................. 374
Drawing Bounds ........................................................................................... 375
Drawing Lines and Shapes ........................................................................... 375
Custom Views .................................................................................................... 376
Invalidating and Drawing Views .................................................................. 376
Graphics Context .......................................................................................... 377
The Graphics Context State Stack................................................................ 378
Drawing Tools ............................................................................................... 380
Animation ...................................................................................................... 381
iPhone View Classes ..................................................................................... 383
Advanced View Topics .................................................................................. 383
Document Model .................................................................................................. 384
Events and Responders ........................................................................................ 385
The Dynamic Application ................................................................................ 385
Events................................................................................................................. 387
Event Objects .................................................................................................... 387
Key Events ......................................................................................................... 388
Mouse Events .................................................................................................... 389
xvii
■ CONTENTS
xviii
■ CONTENTS
xix
■ CONTENTS
xx
Discovering Diverse Content Through
Random Scribd Documents
THE BANKS OF THE AISNE.
In the background: Chapel of the Glass-Works. To the left of the
Chapel, a German Machine-Gun was posted, below a crane.
The road leads back to the village. Return via Vauxrot to the Place
de Laon, then follow on the left the Avenue de Laon to Saint-Paul.
The defence-works visited between Pasly, the glass-works and the
distillery, extended from there in an almost straight and formidable
entrenched line to the National Road from Paris to Maubeuge (N. 2).
ORGANIZED CAVE AT PASLY.
About 556, Clotaire I had the greatly revered Bishop of Noyon, Saint-
Médard, buried in this villa, and erected over his grave a basilica,
round which a monastery was built.
After playing an important part in the history of the early Middle-
Ages, this monastery attracted 300 000 pilgrims as late as 1530. The
buildings were devastated during the many sieges to which Soissons
was subjected. Rebuilt in the 17th, they were converted in the 19th
century into a school for deaf-mutes and the blind.
Of the ancient buildings, there remains only a crypt, one of the
oldest in France and of great archæological interest.
Built in the 9th century and measuring about 80 feet in length, 8 feet
in width and 13 feet in height, this crypt (photo below) includes a
central gallery with groined vault, off which open chapels.
The vaulting rests on very thick walls, in which small niches have
been hollowed out as seats for the pilgrims.
THE CRYPT OF ST-MÉDARD.
One of the oldest crypts in France.
CHURCH OF ST-WAAST IN 1917.
The pont Saint-Waast, also called the Pont des Anglais (since the
war) dates from the Middle-Ages (photo above). Of the original
structure there remain the arches on the Saint-Waast side (restored).
The rest of the bridge consists of an iron platform which the
Germans destroyed on September 13, 1914, when they evacuated
the town.
Rebuilt by the British in 1914, together with a foot-bridge, it ensured
communication between the centre of the town and the Faubourg
Saint-Waast, in spite of incessant bombardments.
Return to the Cathedral by the Rue la Bannière, Rue de Montrevers,
and Rue de l’Hôtel-Dieu.
CONTENTS
Chief Historical
2
Facts
First German
4
Occupation, 1914
Second German
7
Occupation, 1918
The Bombardments 10
A Thirty-Months’
11
Siege
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com