(Ebook) Programming iOS 11: Dive Deep Into Views, View Controllers, and Frameworks by Neuburg, Matt ISBN 9781491999226, 1491999225
(Ebook) Programming iOS 11: Dive Deep Into Views, View Controllers, and Frameworks by Neuburg, Matt ISBN 9781491999226, 1491999225
com
https://ebooknice.com/product/programming-ios-11-dive-deep-
into-views-view-controllers-and-frameworks-11903574
OR CLICK HERE
DOWLOAD EBOOK
(Ebook) Programming IOS 12: Dive Deep Into Views, View Controllers, and Frameworks
by Matt Neuburg ISBN 9781492044635, 1492044636
https://ebooknice.com/product/programming-ios-12-dive-deep-into-views-view-
controllers-and-frameworks-7250914
ebooknice.com
(Ebook) Programming iOS 9: Dive Deep into Views, View Controllers, and Frameworks by
Matt Neuburg ISBN 9781491936856, 1491936851
https://ebooknice.com/product/programming-ios-9-dive-deep-into-views-view-
controllers-and-frameworks-36132456
ebooknice.com
(Ebook) Programming iOS 13: Dive Deep into Views, View Controllers, and Frameworks
by Matt Neuburg ISBN 9781492074618, 1492074616
https://ebooknice.com/product/programming-ios-13-dive-deep-into-views-view-
controllers-and-frameworks-10657918
ebooknice.com
(Ebook) Programming iOS 8: Dive Deep into Views, View Controllers, and Frameworks by
Matt Neuburg ISBN 9781491908730, 1491908734
https://ebooknice.com/product/programming-ios-8-dive-deep-into-views-view-
controllers-and-frameworks-5028286
ebooknice.com
(Ebook) Programming iOS 10: Dive Deep into Views, View Controllers, and Frameworks
by Matt Neuburg ISBN 9781491970164, 1491970162
https://ebooknice.com/product/programming-ios-10-dive-deep-into-views-view-
controllers-and-frameworks-5658538
ebooknice.com
(Ebook) Programming iOS 10: Dive Deep into Views, View Controllers, and Frameworks
by Matt Neuburg ISBN 9781491970164, 1491970162
https://ebooknice.com/product/programming-ios-10-dive-deep-into-views-view-
controllers-and-frameworks-11903572
ebooknice.com
(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James ISBN
9781459699816, 9781743365571, 9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374
ebooknice.com
(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena Alfredsson, Hans Heikne, Sanna
Bodemyr ISBN 9789127456600, 9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312
ebooknice.com
(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT II Success) by Peterson's
ISBN 9780768906677, 0768906679
https://ebooknice.com/product/sat-ii-success-math-1c-and-2c-2002-peterson-s-sat-
ii-success-1722018
ebooknice.com
Programming iOS 11
EIGHTH EDITION
Matt Neuburg
Programming iOS 11, Eighth Edition
by Matt Neuburg
Copyright © 2018 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/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
Cover Designer: Randy Comer
Interior Designer: David Futato
Illustrator: Matt Neuburg
May 2011: First Edition
March 2012: Second Edition
March 2013: Third Edition
December 2013: Fourth Edition
December 2014: Fifth Edition
November 2015: Sixth Edition
November 2016: Seventh Edition
December 2017: Eighth Edition
Revision History for the Eighth Edition:
2017-12-06: First release
See http://oreilly.com/catalog/errata.csp?isbn=9781491999226 for
release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Programming iOS 11, the cover 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 trademark 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.
978-1-491-99922-6
[LSI]
Preface
Pass Kit
The Pass Kit framework allows creation of downloadable passes
to go into the user’s Wallet app.
Health Kit
The Health Kit framework lets your app obtain, store, share, and
present data and statistics related to body activity and exercise.
Externalities
The user can attach an external accessory to the device, either
directly via USB or wirelessly via Bluetooth. Your app can
communicate with such an accessory. See External Accessory
Programming Topics. The Home Kit framework lets the user
communicate with devices in the physical world, such as light
switches and door locks. This book also doesn’t discuss iBeacon
or near field communication (the Core NFC framework, new in
iOS 11).
Handoff
Handoff permits your app to post to the user’s iCloud account a
record of what the user is doing, so that the user can switch to
another copy of your app on another device and resume doing
the same thing. See the Handoff Programming Guide.
Spotlight
The user’s Spotlight search results can include data supplied by
your app. See the App Search Programming Guide.
Siri Kit
The SiriKit framework lets you configure your app so that the
user can talk to the device to tell it what to do.
Augmented Reality
New in iOS 11, certain devices can impose drawn objects into the
world viewed live through the device’s camera by means of the
ARKit framework.
Machine Learning
New in iOS 11, the Core ML framework embraces image analysis
(the Vision framework) as well as decision trees (Gameplay Kit)
and language analysis (NSLinguisticTagger).
Versions
This book is geared to Swift 4, iOS 11, and Xcode 9. In general, only
very minimal attention is given to earlier versions of iOS and Xcode.
It is not my intention to embrace in this book any detailed
knowledge about earlier versions of the software, which is, after all,
readily and compendiously available in my earlier books.
A word about method names. I generally give method names in
Swift, in the style of a function reference — that is, the name plus
parentheses containing the parameter labels followed by colon. Now
and then, if a method is already under discussion and there is no
ambiguity, I’ll use the bare name. In a few places, where the
Objective-C language is explicitly under discussion, I use Objective-C
method names.
Please bear in mind that Apple continues to make adjustments to
the Swift language and to the way the Objective-C APIs are bridged
to it. I have tried to keep my code up-to-date right up to the
moment when the manuscript left my hands; but if, at some future
time, a new version of Xcode is released along with a new version of
Swift, some of the code in this book might be slightly incorrect.
Please make allowances, and be prepared to compensate.
Screenshots of Xcode were taken using Xcode 9 under macOS 10.12
Sierra. I have not upgraded my machine to macOS 10.13 High
Sierra, because at the time of this writing it was too new to be
trusted with mission-critical work. If you are braver than I am and
running High Sierra, your interface may naturally look very slightly
different from the screenshots, but this difference will be minimal
and shouldn’t cause any confusion.
Acknowledgments
My thanks go first and foremost to the people at O’Reilly Media who
have made writing a book so delightfully easy: Rachel Roumeliotis,
Sarah Schneider, Kristen Brown, Dan Fauxsmith, Adam Witwer, and
Sanders Kleinfeld come particularly to mind. And let’s not forget my
first and long-standing editor, Brian Jepson, whose influence is
present throughout.
As in the past, I have been greatly aided by some fantastic software,
whose excellences I have appreciated at every moment of the
process of writing this book. I should like to mention, in particular:
git (http://git-scm.com)
SourceTree (http://www.sourcetreeapp.com)
TextMate (http://macromates.com)
AsciiDoc (http://www.methods.co.nz/asciidoc)
Asciidoctor (http://asciidoctor.org)
BBEdit (http://barebones.com/products/bbedit/)
EasyFind
(http://www.devontechnologies.com/products/freeware.html)
Snapz Pro X (http://www.ambrosiasw.com)
GraphicConverter (http://www.lemkesoft.com)
OmniGraffle (http://www.omnigroup.com)
GoodReader (http://www.goodreader.com)
The book was typed and edited entirely on my faithful Unicomp
Model M keyboard (http://pckeyboard.com), without which I could
never have done so much writing over so long a period so painlessly.
For more about my physical work environment, see
http://matt.neuburg.usesthis.com.
Constant width
Used for program listings, as well as within paragraphs to refer to
program elements such as variable or function names, databases,
data types, environment variables, statements, and keywords.
TIP
This element signifies a tip or suggestion.
NOTE
This element signifies a general note.
WARNING
This element indicates a warning or caution.
O’Reilly Safari
NOTE
Safari (formerly Safari Books Online) is membership-based training
and reference platform for enterprise, government, educators, and
individuals.
Members have access to thousands of books, training videos,
Learning Paths, interactive tutorials, and curated playlists from over
250 publishers, including O’Reilly Media, Harvard Business Review,
Prentice Hall Professional, Addison-Wesley Professional, Microsoft
Press, Sams, Que, Peachpit Press, Adobe, Focal Press, Cisco Press,
John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks,
Packt, Adobe Press, FT Press, Apress, Manning, New Riders,
McGraw-Hill, Jones & Bartlett, and Course Technology, among
others.
For more information, please visit http://oreilly.com/safari.
How to Contact Us
Please address comments and questions concerning this book to the
publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples,
and any additional information. You can access this page at
http://bit.ly/programming_iOS11.
To comment or ask technical questions about this book, send email
to bookquestions@oreilly.com.
For more information about our books, courses, conferences, and
news, see our website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Part I. Views
Views are what your user sees on the screen and interacts with by
touching the screen. The book begins by explaining how they work.
Chapter 1 discusses views in their most general aspect — their
hierarchy, visibility, position, and layout.
Chapter 2 is about drawing. A view knows how to draw itself; this
chapter explains how to tell a view what you want it to draw.
Chapter 3 explains about layers. The drawing power of a view
comes ultimately from its layer.
Chapter 4 talks about animation, which you’ll use to enliven your
app’s interface.
Chapter 5 explains how your app senses and responds to the user
touching the screen.
Chapter 1. Views
NOTE
If your app can display views on an external screen, you’ll create an additional
UIWindow to contain those views; but in this book I’ll assume there is just one
screen, the device’s own screen, and just one window.
Subclassing UIWindow
Another possible variation is to subclass UIWindow. That is
uncommon nowadays, though it can be a way of intervening in hit-
testing (Chapter 5) or the target–action mechanism (Chapter 12). To
make an instance of your UIWindow subclass your app’s main
window, you would need to prevent UIApplicationMain from
assigning a plain vanilla UIWindow instance as your app delegate’s w
indow. The rule is that, after UIApplicationMain has instantiated the
app delegate, it asks the app delegate instance for the value of its wi
ndow property. If that value is nil, UIApplicationMain instantiates
UIWindow and assigns that instance to the app delegate’s window
property. If that value is not nil, UIApplicationMain leaves it alone.
Therefore, to make your app’s main window be an instance of your
UIWindow subclass, all you have to do is assign that instance as the
default value for the app delegate’s window property:
@UIApplicationMain
class AppDelegate : UIResponder, UIApplicationDelegate {
var window : UIWindow? = MyWindow()
// ...
}
let w = UIApplication.shared.delegate!.window!!
let w = UIApplication.shared.keyWindow!
Try it! Make a new project from the Single View app template, and
make the ViewController class’s viewDidLoad look like that. Run the
app. You will actually see the small red square in the running app’s
interface.
When views are created in the nib, you can examine the view
hierarchy in the nib editor’s document outline to learn their actual
relationship (Figure 1-2). When views are created in code, you know
their hierarchical relationship because you created that hierarchy.
But the visible interface doesn’t tell you, because view overlapping is
so flexible.
Figure 1-2. A view hierarchy as displayed in the nib editor
B. Mechanische Fruchtabtreibungsmittel.
Zu den mechanischen
Fruchtabtreibungsmitteln müssen auch noch Blutentziehungen.
starke Blutentziehungen gerechnet werden, von denen insbesondere
der Aderlass verhältnissmässig häufig, seltener das Setzen von
Blutegeln in Anwendung gezogen wird.
Es kann nicht geleugnet werden, dass eine hochgradige, namentlich eine
plötzlich erzeugte Anämie den Abortus möglicherweise zu bewirken im Stande sein
wird, einestheils indem durch die Verminderung der Blutmenge der Mutter die
Respiration der Frucht leidet, andererseits weil eine plötzliche Anämie der
Nervencentren thatsächlich Uteruscontractionen hervorzurufen vermag, wie die
Versuche von O s e r und S c h l e s i n g e r , sowie unsere eigenen gezeigt haben.
Trotzdem wird es wohl nur ganz selten geschehen, dass durch Aderlässe etc. der
Anstoss zur Fehlgeburt gegeben wird, da bei diesen die Blutentleerung kaum je so
weit getrieben wird, dass dadurch entweder Lebensgefahr für die Frucht bedingt
oder eine Reizung der Centra der Uterusbewegung gesetzt wird, wie auch trotz der
Häufigkeit, in welcher Blutentziehungen zu Fruchtabtreibungszwecken in
Anwendung gezogen wurden, unseres Wissens kein Fall bekannt ist, in welchem
nur durch diese der Abortus hervorgerufen worden wäre. Im Gegentheil sah
M o r i c e a u bei zwei Individuen die Entbindung normal verlaufen, obgleich das eine
48mal, das andere 90mal sich während der Schwangerschaft zur Ader gelassen
hatte (G a l l a r d , pag. 23).
Nichtsdestoweniger sind diese Vorgänge von grosser forensischer Bedeutung,
weil der Befund von frischen Aderlasswunden oder Blutegelstichen häufig den
Verdacht bestärkt, dass die Betreffende Fruchtabtreibungsversuche unternommen
habe, besonders dann, wenn solche Befunde sich an Stellen ergeben, wo, wie z. B.
an den Füssen oder an den Genitalien, aus therapeutischen Zwecken selten oder
gar nicht Aderlässe oder Blutegel gesetzt werden.
Durch den elektrischen Strom, namentlich den
constanten, können Contractionen des Uterus Elektricität.
hervorgerufen werden und wurde derselbe bereits
wiederholt zur Einleitung der ärztlich indicirten Frühgeburt mit Erfolg angewendet,
so insbesondere von B a y e r (Zeitschr. für Geburtsh. und Gyn. XII und Prager med.
Wochenschr. 1889, Nr. 48). Die Kathode wurde in den Cervix eingeführt, die Anode
auf den Bauch oder die Kreuzbeingegend applicirt. Nach B a y e r ist dieses in den
meisten Fällen ein sicheres und absolut ungefährliches Mittel zur Einleitung der
künstlichen Frühgeburt, womit allerdings die Erfahrungen anderer Beobachter
(F r ä n k e l , B u m m , F l e i s c h m a n n , B r ü h l ) nicht ganz übereinstimmen. In Amerika
soll das Mittel zur Fruchtabtreibung nicht gar selten benützt werden. R o s e n s t i r n
(Virchow’s Jahresb. 1881, II, 562) erzählt von einer Dame, an welcher die
Operation in einem „elektrischen Bade“ geschah, wo ihr ein Strom von 60
Daniell’schen Elementen 10 Minuten lang vom Kreuzbein nach dem Introitus
vaginae durchgeleitet wurde. Der Abortus erfolgte am anderen Tage.
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.
ebooknice.com