Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Programming iOS 9
Preface
The Scope of This Book
Some Swift Conventions
Versions
Acknowledgments
From the Programming iOS 4 Preface
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
I. Views
1. Views
The Window
Experimenting With Views
Subview and Superview
Visibility and Opacity
Frame
Bounds and Center
Window Coordinates and Screen Coordinates
Transform
Trait Collections and Size Classes
Layout
Autoresizing
Autolayout
Constraints
Autoresizing constraints
Creating constraints in code
Anchor notation
Visual format notation
Constraints as objects
Guides and margins
Intrinsic content size and alignment rects
Stack views
Internationalization
Mistakes with constraints
Configuring Layout in the Nib
Autoresizing in the nib
Constraints in the nib
Creating a constraint
Viewing and editing constraints
Problems with constraints
Conditional constraints
View Debugging, Previewing, and Designing
View debugger
Previewing your interface
Designable views and inspectable properties
View Events Related to Layout
2. Drawing
Images and Image Views
Image Files
Image Views
Resizable Images
Image Rendering Mode
Reversible Images
Graphics Contexts
UIImage Drawing
CGImage Drawing
Snapshots
CIFilter and CIImage
Blur and Vibrancy Views
Drawing a UIView
Graphics Context Settings
Paths and Shapes
Clipping
Gradients
Colors and Patterns
Graphics Context Transforms
Shadows
Erasing
Points and Pixels
Content Mode
3. Layers
View and Layer
Layers and Sublayers
Manipulating the Layer Hierarchy
Positioning a Sublayer
CAScrollLayer
Layout of Sublayers
Drawing in a Layer
Content Resizing and Positioning
Layers that Draw Themselves
Transforms
Depth
Shadows, Borders, and Masks
Layer Efficiency
Layers and Key–Value Coding
4. Animation
Drawing, Animation, and Threading
Image View and Image Animation
View Animation
View Animation Options
Canceling a View Animation
Custom Animatable View Properties
Springing View Animation
Keyframe View Animation
Transitions
Implicit Layer Animation
Animation Transactions
Media Timing Functions
Core Animation
CABasicAnimation and Its Inheritance
Using a CABasicAnimation
Springing Animation
Keyframe Animation
Making a Property Animatable
Grouped Animations
Freezing an Animation
Transitions
Animations List
Actions
What an Action Is
Action Search
Hooking Into the Action Search
Making a Custom Property Implicitly Animatable
Nonproperty Actions
Emitter Layers
CIFilter Transitions
UIKit Dynamics
The Dynamics Stack
Custom Behaviors
Animator and Behaviors
UIDynamicItemBehavior
UIGravityBehavior
UIFieldBehavior
UIPushBehavior
UICollisionBehavior
UISnapBehavior
UIAttachmentBehavior
Motion Effects
Animation and Autolayout
5. Touches
Touch Events and Views
Receiving Touches
Restricting Touches
Interpreting Touches
Gesture Recognizers
Gesture Recognizer Classes
Gesture Recognizer Conflicts
Subclassing Gesture Recognizers
Gesture Recognizer Delegate
Gesture Recognizers in the Nib
Touch Delivery
Hit-Testing
Hit-testing for layers
Hit-testing for drawings
Hit-testing during animation
Initial Touch Event Delivery
Gesture Recognizer and View
Touch Exclusion Logic
Gesture Recognition Logic
Touches and the Responder Chain
II. Interface
6. View Controllers
View Controller Responsibilities
View Controller Hierarchy
View Controller Creation
How a View Controller Gets Its View
Manual View
Generic Automatic View
View in a Separate Nib
Nib-Instantiated View Controller
Storyboard-Instantiated View Controller
View Resizing
View Size in the Nib Editor
Bars and Underlapping
Status bar visibility
Extended layout
Resizing Events
Rotation
Permitting compensatory rotation
Initial orientation
Initial layout
Responding to rotation
Presented View Controller
Presenting a View
Communication With a Presented View Controller
Presented View Animation
Presentation Styles
Adaptive Presentation
Rotation of a Presented View
Tab Bar Controller
Tab Bar Items
Configuring a Tab Bar Controller
Navigation Controller
Bar Button Items
Navigation Items and Toolbar Items
Configuring a Navigation Controller
Custom Transition
Noninteractive Custom Transition Animation
Interactive Custom Transition Animation
Using a percent driver
Without a percent driver
Custom Presented View Controller Transition
Customizing the animation
Customizing the presentation
Transition Coordinator
Page View Controller
Preparing a Page View Controller
Page View Controller Navigation
Page indicator
Navigation gestures
Other Page View Controller Configurations
Container View Controllers
Adding and Removing Children
Container View Controllers, Traits, and Resizing
Storyboards
Triggered Segues
Triggered segue behavior
How a segue is triggered
View controller communication
Container Views and Embed Segues
Storyboard References
Unwind Segues
Creating an unwind segue
How an unwind segue works
How the destination view controller is found
How an unwind segue is performed
Unwind segue customization
View Controller Lifetime Events
Incoherencies in View Controller Events
Appear and Disappear Events
Event Forwarding to a Child View Controller
View Controller Memory Management
State Restoration
How to Test State Restoration
Participating in State Restoration
Restoration ID, Identifier Path, and Restoration Class
Restoring View Controller State
Restoration Order of Operations
Restoration of Other Objects
Snapshot Suppression
7. Scroll Views
Creating a Scroll View in Code
Manual Content Size
Automatic Content Size With Autolayout
Using a Content View
Scroll View in a Nib
Scrolling
Paging
Tiling
Zooming
Zooming Programmatically
Zooming with Detail
Scroll View Delegate
Scroll View Touches
Floating Scroll View Subviews
Scroll View Performance
8. Table Views and Collection Views
Table View Cells
Built-In Cell Styles
Registering a Cell Class
Custom Cells
Overriding a cell’s subview layout
Adding subviews in code
Designing a cell in a nib
Designing a cell in a storyboard
Table View Data
The Three Big Questions
Reusing Cells
Table View Sections
Section headers and footers
Section data
Section index
Refreshing Table View Data
Variable Row Heights
Manual row height measurement
Measurement and layout with constraints
Estimated height
Automatic row height
Table View Cell Selection
Managing Cell Selection
Responding to Cell Selection
Navigation From a Table View
Cell Choice and Static Tables
Table View Scrolling and Layout
Table View State Restoration
Table View Searching
Configuring a Search Controller
Using a Search Controller
Minimal search results table
Search bar scope buttons
Customizing the presentation
Search bar in navigation bar
No secondary search results view controller
Table View Editing
Deleting Cells
Custom Action Buttons
Editable Content in Cells
Inserting Cells
Rearranging Cells
Dynamic Cells
Table View Menus
Collection Views
Collection View Classes
Using a Collection View
Custom Collection View Layouts
Switching Layouts
Collection Views and UIKit Dynamics
9. iPad Interface
Popovers
Preparing a Popover
Arrow source and direction
Popover size and position
Popover appearance
Passthrough views
Popover Presentation, Dismissal, and Delegate
Adaptive Popovers
Popover Segues
Popover Presenting a View Controller
Split Views
Expanded Split View Controller (iPad)
Collapsed Split View Controller (iPhone)
Expanding Split View Controller (iPhone 6 Plus)
Customizing a Split View Controller
Setting the Collapsed State
Replacing the Child View Controllers
Split View Controller in a Storyboard
iPad Multitasking
10. Text
Fonts and Font Descriptors
Fonts
Dynamic Type fonts
Adding fonts
Font Descriptors
Attributed Strings
Attributed String Attributes
Making an Attributed String
Tab stops
Text attachments
Other ways to create an attributed string
Modifying and Querying an Attributed String
Custom Attributes
Drawing and Measuring an Attributed String
Labels
Number of Lines
Wrapping and Truncation
Resizing a Label to Fit Its Text
Customized Label Drawing
Text Fields
Summoning and Dismissing the Keyboard
Keyboard Covers Text Field
Sliding the interface
Text field in a scroll view
Configuring the Keyboard
Text Field Delegate and Control Event Messages
Text Field Menu
Text Views
Text View as Scroll View
Text View and Keyboard
Text Kit
Text Container
Alternative Text Kit Stack Architectures
Layout Manager
Text Kit Without a Text View
11. Web Views
WKWebView
WKWebView Content
Tracking Changes in a WKWebView
WKWebView Navigation
Communicating With a WKWebView Web Page
WKWebView Shortcomings
Safari View Controller
Developing Web View Content
12. Controls and Other Views
UIActivityIndicatorView
UIProgressView
UIPickerView
UISearchBar
UIControl
UISwitch
UIStepper
UIPageControl
UIDatePicker
UISlider
UISegmentedControl
UIButton
Custom Controls
Bars
Bar Position and Bar Metrics
Bar Appearance
UIBarButtonItem
UINavigationBar
UIToolbar
UITabBar
Tint Color
Appearance Proxy
13. Modal Dialogs
Alerts and Action Sheets
Alerts
Action Sheets
Dialog Alternatives
Local Notifications
Registering a Notification
Scheduling a Notification
Hearing About a Local Notification
Today Extensions
Activity Views
Presenting an Activity View
Custom Activities
Action Extensions
Action extension without an interface
Action extension with an interface
Receiving data from an action extension
Share Extensions
III. Some Frameworks
14. Audio
System Sounds
Audio Session
Activation
Ducking
Interruptions
Secondary Audio
Routing Changes
Audio Player
Remote Control of Your Sound
Playing Sound in the Background
AVAudioEngine
MIDI Playback
Speech Synthesis
Further Topics in Sound
15. Video
AVPlayerViewController
Other AVPlayerViewController Properties
Picture-in-Picture
Introducing AV Foundation
Some AV Foundation Classes
Things Take Time
Time is Measured Oddly
Constructing Media
Synchronizing Animation With Video
AVPlayerLayer
Further Exploration of AV Foundation
UIVideoEditorController
16. Music Library
Exploring the Music Library
Querying the Music Library
Persistence and Change in the Music Library
Music Player
MPVolumeView
Playing Songs With AV Foundation
Media Picker
17. Photo Library and Image Capture
Photo Library Authorization
Choosing From the Photo Library
Photos Framework
Querying the Photo Library
Modifying the Library
Being Notified of Changes
Displaying Images
Editing Images
Photo Editing Extension
Using the Camera
Camera Authorization
Using the Camera with UIImagePickerController
Customizing the Image Capture Interface
Image Capture With AV Foundation
18. Contacts
Contacts Authorization
Fetching Contact Information
Saving Contact Information
Contact Sorting, Groups, and Containers
Contacts Interface
CNContactPickerViewController
CNContactViewController
Existing contact
Unknown contact
New contact
19. Calendar
Calendar Database
Calendar Database Authorization
Calendar Database Contents
Calendars
Calendar items
Calendar Database Changes
Creating Calendars and Events
Recurrence
Fetching Events
Reminders
Proximity Alarms
Calendar Interface
EKEventViewController
EKEventEditViewController
EKCalendarChooser
20. Mail and Messages
Mail Message
Text Message
Twitter Post
21. Maps
Displaying a Map
Annotations
Custom Annotation View
Custom Annotation Class
Other Annotation Features
Overlays
Custom Overlay Class
Custom Overlay Renderer
Other Overlay Features
Map Kit and Current Location
Communicating With the Maps App
Geocoding, Searching, and Directions
Geocoding
Searching
Directions
22. Sensors
Core Location
Location Manager and Delegate
Core Location Authorization
Location Tracking
Where Am I?
Heading
Background Location
Continuous background location
Location monitoring
Acceleration, Attitude, and Activity
Shake Events
Raw Acceleration
Gyroscope
Motion Activity
IV. Final Topics
23. Persistent Storage
The Sandbox
Standard Directories
Visually Inspecting the Sandbox
Basic File Operations
Saving and Reading Files
User Defaults
Simple Sharing and Previewing of Files
File Sharing
Document Types and Receiving a Document
Handing Over a Document
Previewing a Document
Document Architecture
iCloud
XML
SQLite
Core Data
Image File Formats
24. Basic Networking
HTTP Requests
Simple HTTP Request
Formal HTTP Request
Encapsulating the Session, Task, and Delegate
Downloading Table View Data
Background Downloads
Background App Refresh
On-Demand Resources
In-App Purchases
25. Threads
Main Thread
Why Threading Is Hard
Blocking the Main Thread
Manual Threading
NSOperation
Grand Central Dispatch
Threads and App Backgrounding
26. Undo
Undo Manager
Target–Action Undo
Undo Grouping
Invocation Undo
Functional Undo
Undo Interface
Shake-To-Edit
Undo Menu
A. Application Lifetime Events
Application States
App Delegate Events
App Lifetime Scenarios
B. Some Useful Utility Functions
Delayed Performance
Center of a CGRect
Adjust a CGSize
Dictionary of Views
Constraint Issues
Drawing Into an Image Context
Finite Repetition of an Animation
Remove Multiple Indexes From Array
Configure a Value Class At the Point of Use
Cancelable Closure-Based Timer
Generic Wrapper
Index
Colophon
Copyright
← Prev
Back
Next →
← Prev
Back
Next →