Programming iOS 7 - Matt Neuburg.pdf

(12086 KB) Pobierz
FOURTH EDITION
Programming iOS 7
Matt Neuburg
Programming iOS 7, Fourth Edition
by Matt Neuburg
Copyright © 2014 Matt Neuburg. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: (800) 998-9938 or
corporate@oreilly.com.
Editor:
Rachel Roumeliotis
Production Editor:
Kristen Brown
Proofreader:
O’Reilly Production Services
Indexer:
Matt Neuburg
May 2011:
March 2012:
March 2013:
December 2013:
First Edition
Second Edition
Third Edition
Fourth Edition
Cover Designer:
Randy Comer
Interior Designer:
David Futato
Illustrator:
Matt Neuburg
Revision History for the Fourth Edition:
2013-12-09:
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449372347
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc.
Programming iOS 7,
the image of a kingbird, and related trade dress are trademarks of O’Reilly
Media, Inc.
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 O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-37234-7
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Part I.
Views
4
7
8
11
12
13
16
22
23
27
38
45
46
49
53
56
58
61
63
66
68
72
iii
1. Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
The Window
Experimenting With Views
Subview and Superview
Visibility and Opacity
Frame
Bounds and Center
Transform
Layout
Autoresizing
Autolayout
Constraints in the Nib
Order of Layout Events
Autolayout and View Transforms
UIImage and UIImageView
Resizable Images
Image Rendering Mode
Graphics Contexts
UIImage Drawing
CGImage Drawing
Snapshots
CIFilter and CIImage
Drawing a UIView
2. Drawing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Zgłoś jeśli naruszono regulamin