Programming iOS 10 - Matt Neuburg.pdf

(10966 KB) Pobierz
Programming
iOS 10
DIVE DEEP INTO VIEWS, VIEW CONTROLLERS, AND FRAMEWORKS
Matt Neuburg
Xc
0, t 3
S 1 if
i O Sw
rs nd
ve , a
Co e 8
od
SEVENTH EDITION
Programming iOS 10
Matt Neuburg
Boston
Programming iOS 10, Seventh Edition
by Matt Neuburg
Copyright © 2017 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://oreilly.com/safari). For more information, contact our corporate/insti‐
tutional 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:
December 2014:
November 2015:
November 2016:
First Edition
Second Edition
Third Edition
Fourth Edition
Fifth Edition
Sixth Edition
Seventh Edition
Cover Designer:
Randy Comer
Interior Designer:
David Futato
Illustrator:
Matt Neuburg
Revision History for the Seventh Edition:
2016-11-08:
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781491970164
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Programming iOS 10,
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 the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
ISBN: 978-1-491-97016-4
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Part I.
Views
4
6
7
10
11
12
16
17
21
22
24
25
28
28
30
31
37
39
44
46
49
49
54
iii
1. Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
The Window
Experimenting with Views
Subview and Superview
Visibility and Opacity
Frame
Bounds and Center
Window Coordinates and Screen Coordinates
Transform
App Rotation
Trait Collections and Size Classes
Layout
Autoresizing
Autolayout
Constraints
Autoresizing Constraints
Creating Constraints in Code
Constraints as Objects
Guides and Margins
Intrinsic Content Size and Alignment Rects
Stack Views
Internationalization
Mistakes with Constraints
Configuring Layout in the Nib
Zgłoś jeśli naruszono regulamin