224 Modernizing Your Ui For Ios 13 PDF
224 Modernizing Your Ui For Ios 13 PDF
© 2019 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
•
Flexible UI
•
Bars
•
Presentations
•
Search
•
Gestures
•
Menus
•
Flexible UI
David Duncan
Launch Storyboards
Launch Storyboards
Launch Images
Be Resizable
Be Resizable
Be Resizable
Actions
Bars
New Bar Appearance
Appearance Customization
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
navigationBar.standardAppearance = appearance
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
navigationBar.standardAppearance = appearance
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
navigationBar.standardAppearance = appearance
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
navigationBar.standardAppearance = appearance
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
navigationBar.standardAppearance = appearance
// Customizing
.standardAppearance
// Customizing
.compactAppearance
// Customizing
.scrollEdgeAppearance
// Customizing
.buttonAppearance .doneButtonAppearance
Customizing Bars
UIToolbar: UIToolbarAppearance
UITabBar: UITabBarAppearance
// Customizing
.stackedLayoutAppearance
.inlineLayoutAppearance
.compactInlineLayoutAppearance
let appearance = navigationBar.standardAppearance.copy()
navigationItem.standardAppearance = appearance
let appearance = navigationBar.standardAppearance.copy()
navigationItem.standardAppearance = appearance
let appearance = navigationBar.standardAppearance.copy()
navigationItem.standardAppearance = appearance
let appearance = navigationBar.standardAppearance.copy()
navigationItem.standardAppearance = appearance
•
Presentations
Russell Ladd
Sheets
Sheet
UIModalPresentationStyle.pageSheet
UIModalPresentationStyle.pageSheet
.formSheet
Readable Width
Readable Width
Readable Width
UIModalPresentationStyle.pageSheet
.formSheet
NEW
UIModalPresentationStyle.automatic
.pageSheet
.formSheet
class MyViewController: UIViewController {
func pickPhoto() {
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .photoLibrary
present(imagePicker, animated: true)
}
func presentCamera() {
let camera = UIImagePickerController()
camera.sourceType = .camera
present(camera, animated: true)
}
}
class MyViewController: UIViewController {
func pickPhoto() {
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .photoLibrary
present(imagePicker, animated: true)
}
func presentCamera() {
let camera = UIImagePickerController()
camera.sourceType = .camera
present(camera, animated: true)
}
}
class MyViewController: UIViewController {
func pickPhoto() {
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .photoLibrary
present(imagePicker, animated: true)
}
func presentCamera() {
let camera = UIImagePickerController()
camera.sourceType = .camera
present(camera, animated: true)
}
}
class MyViewController: UIViewController {a
func showOptions() {a
let optionsVC = MyOptionsViewController()
present(optionsVC, animated: true)
}a
func showCustomCamera() {a
let cameraVC = MyCameraViewController()
present(cameraVC, animated: true)
}a
}a
class MyViewController: UIViewController {a
func showOptions() {a
let optionsVC = MyOptionsViewController()
present(optionsVC, animated: true)
}a
func showCustomCamera() {a
let cameraVC = MyCameraViewController()
present(cameraVC, animated: true)
}a
}a
class MyViewController: UIViewController {a
func showOptions() {a
let optionsVC = MyOptionsViewController()
present(optionsVC, animated: true)
}a
func showCustomCamera() {a
let cameraVC = MyCameraViewController()
present(cameraVC, animated: true)
}a
}a
class MyViewController: UIViewController {a
func showOptions() {a
let optionsVC = MyOptionsViewController()
present(optionsVC, animated: true)
}a
func showCustomCamera() {a
let cameraVC = MyCameraViewController()
cameraVC.modalPresentationStyle = .fullScreen
present(cameraVC, animated: true)
}a
}a
class MyViewController: UIViewController {
func showOptions() {
let optionsVC = MyOptionsViewController()
optionsVC.modalPresentationStyle = .popover
present(optionsVC, animated: true)
}
}
class MyViewController: UIViewController {
func showOptions() {
let optionsVC = MyOptionsViewController()
optionsVC.modalPresentationStyle = .popover
present(optionsVC, animated: true)
}
}
NEW
class EmailController: UIViewController, UIAdaptivePresentationControllerDelegate {
func draftDidChange() {
isModalInPresentation = draft.hasChanges
}
func draftDidChange() {
isModalInPresentation = draft.hasChanges
}
func draftDidChange() {
isModalInPresentation = draft.hasChanges
}
presentedViewController
.isModalInPresentation
True
presentationController-
DidAttemptToDismiss
User Begins Pulling User Releases with Intent
presentedViewController
.isModalInPresentation
True
presentationController-
False
DidAttemptToDismiss
False
presentationController-
ShouldDismiss
True
presentationController- presentationController-
WillDismiss DidDismiss
User Begins Pulling User Releases with Intent
presentedViewController
.isModalInPresentation
True
presentationController-
False
DidAttemptToDismiss
False
presentationController-
ShouldDismiss
True
presentationController- presentationController-
WillDismiss DidDismiss
Share Extensions
,,,
• Respond to
presentationControllerDidAttemptToDismiss
Share Extensions
,,,
• Respond to
presentationControllerDidAttemptToDismiss
Share Extensions
,,,
• Respond to
presentationControllerDidAttemptToDismiss
Share Extensions
,,,
• Respond to
presentationControllerDidAttemptToDismiss
Appearance Callbacks
Full Screen
Presentation Dismissal
Presentation Dismissal
rootViewController.view
UIWindow
rootViewController.view
Updating Your App
Use sheets
Search
Kyle Sluder
UISearchController
Cancel Button
UISearchBar
Scope Bar
Cancel Button
NEW
UISearchBar
Scope Bar
NEW
NEW
UISearchTextField
NEW
UISearchTextField
func loadView() {
/* ... */
}
func loadView() {
/* ... */
}
func loadView() {
/* ... */
}
Search Results Controller
NEW
self.navigationItem.searchController = searchController
/* ... */
}
func loadView() {
self.navigationItem.searchController = searchController
/* ... */
}
Search Tokens NEW
Copy, Paste
Copy, Paste
.selectedTextRange
b e a c h
Ranges and Positions
UITextPosition
b e a c h
Ranges and Positions
UITextPosition
b e a c h
Ranges and Positions
.beginningOfDocument
b e a c h
.endOfDocument
Ranges and Positions
.beginningOfDocument
b e a c h
.endOfDocument
Ranges and Positions
.beginningOfDocument
b e a c h
.endOfDocument
Ranges and Positions
.textualRange
b e a c h
Ranges and Positions
textualRange.start
b e a c h
textualRange.end
Updating Your App
Adopt UISearchToken
Gestures
James Magahern
•
Editing gestures
UITextInteraction NEW
// Assign `textInput` property to your view that implements the UITextInput protocol
selectionInteraction.textInput = textView
Editing gestures
shift
Multiple Selection
• Disable UI
Adopting Multiple Selection Gestures NEW
Editing gestures
Editing Gestures in iOS 13 NEW
Menus
Mohammed Jisrawi
•
UIContextMenuInteraction
•
UIContextMenuInteraction
Rich previews
Complex hierarchies
Nested sub-menus
In-line sections
•
UIContextMenuInteraction
Rich previews
Complex hierarchies
Nested sub-menus
In-line sections
•
Consistent Gestures
3D Touch
Haptic Touch
Long press
Secondary click
•
Consistent Gestures
3D Touch
Haptic Touch
Long press
Secondary click
•
UIMenu
UIAction(“Share”)
UIAction(“Delete”)
•
UIMenu
UIAction(“Share”)
UIMenu(“Edit…”)
UIAction(“Copy”)
UIAction(“Duplicate”)
UIAction(“Delete”)
// Create a UIContextMenuInteraction with Some Delegate
let interaction = UIContextMenuInteraction(delegate: self)
UIContextMenuInteractionDelegate
UIContextMenuConfiguration
// ...
return UIMenu(children: [
UIAction(title: "Share") { ... },
editMenu,
UIAction(title: "Delete", style: .destructive) { ... }
])
}.
return UIMenu(children: [
UIAction(title: "Share") { ... },
editMenu,
UIAction(title: "Delete", style: .destructive) { ... }
])
}.
return UIMenu(children: [
UIAction(title: "Share") { ... },
editMenu,
UIAction(title: "Delete", style: .destructive) { ... }
])
}.
return UIMenu(children: [
UIAction(title: "Share") { ... },
editMenu,
UIAction(title: "Delete", style: .destructive) { ... }
])
}.
Animation customization
Animation customization
// UITableViewDelegate
optional func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAtIndexPath
indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?
•
// UITableViewDelegate
optional func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAtIndexPath
indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?
UIViewControllerPreviewing
Peek and.Pop
UIViewControllerPreviewing
UIContextMenuInteraction
Updating Your App