228 a look inside presentation controllers 02 df€¦ · a look inside presentation controllers...
TRANSCRIPT
![Page 1: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/1.jpg)
© 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
#WWDC14
A Look Inside Presentation ControllersWith a case study on alerts and search
Session 228 Peter Hajas UIKit Engineer
Frameworks
!
Jim Turner UIKit Engineer
![Page 2: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/2.jpg)
Intro
![Page 3: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/3.jpg)
Intro
Animator objects
![Page 4: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/4.jpg)
Intro
Animator objects• Custom presentation difficult
![Page 5: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/5.jpg)
Intro
Animator objects• Custom presentation difficult
UIPresentationController
![Page 6: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/6.jpg)
Agenda
![Page 7: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/7.jpg)
Agenda
Presentation basics
![Page 8: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/8.jpg)
Agenda
Presentation basics
UIKit presentations
![Page 9: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/9.jpg)
Agenda
Presentation basics
UIKit presentations
Demo
![Page 10: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/10.jpg)
![Page 11: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/11.jpg)
![Page 12: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/12.jpg)
![Page 13: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/13.jpg)
Presented
![Page 14: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/14.jpg)
Presented
Presenting
![Page 15: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/15.jpg)
Content
Presented
![Page 16: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/16.jpg)
Chrome
Presenting
![Page 17: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/17.jpg)
Hello, UIPresentationController
![Page 18: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/18.jpg)
Hello, UIPresentationController
Presentation management
![Page 19: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/19.jpg)
Hello, UIPresentationController
Presentation management
Animates
![Page 20: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/20.jpg)
Hello, UIPresentationController
Presentation management
Animates
Trait and size changes
![Page 21: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/21.jpg)
Hello, UIPresentationController
Presentation management
Animates
Trait and size changes
Reusable
![Page 22: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/22.jpg)
UIPresentationControllerDivision of responsibilities
![Page 23: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/23.jpg)
UIPresentationControllerDivision of responsibilities
Animator object
![Page 24: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/24.jpg)
UIPresentationControllerDivision of responsibilities
Animator object
Animating controller content
![Page 25: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/25.jpg)
UIPresentationControllerDivision of responsibilities
Animator object
Animating controller content
Positioning
![Page 26: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/26.jpg)
UIPresentationControllerDivision of responsibilities
Animator object
Animating controller content
Positioning
Chrome
![Page 27: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/27.jpg)
UIPresentationControllerDivision of responsibilities
Animator object Presentation controller
Animating controller content
Positioning
Chrome
![Page 28: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/28.jpg)
UIPresentationControllerDivision of responsibilities
Animator object Presentation controller
Animating controller content Positioning
Chrome
![Page 29: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/29.jpg)
UIPresentationControllerDivision of responsibilities
Animator object Presentation controller
Animating controller content Positioning
Chrome
Adaptation
![Page 30: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/30.jpg)
UIKit PresentationsPopovers, alerts, action sheets, and search
![Page 31: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/31.jpg)
UIPopoverPresentationController
![Page 32: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/32.jpg)
UIPopoverPresentationController
Replacing UIPopoverController
![Page 33: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/33.jpg)
UIPopoverPresentationController
Replacing UIPopoverController
Functionally equivalent
![Page 34: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/34.jpg)
UIPopoverPresentationController
Replacing UIPopoverController
Functionally equivalent
Built-in adaptivity
![Page 35: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/35.jpg)
UIPopoverControllerOld API
UIViewController *contentController = …; UIPopoverController *poc = [[UIPopoverController alloc] initWithContentViewController:contentController]; [poc presentPopoverFromBarButtonItem:item permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
![Page 36: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/36.jpg)
UIPopoverControllerOld API
UIViewController *contentController = …; !
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { UIPopoverController *poc = [[UIPopoverController alloc] initWithContentViewController:contentController]; !
[poc presentPopoverFromBarButtonItem:item permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } !
else { [self presentViewController:contentController …]; }
![Page 37: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/37.jpg)
UIPopoverPresentationControllerNew API
contentController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popPC = contentController.popoverPresentationController; popPC.barButtonItem = item; popPC.permittedArrowDirections = UIPopoverArrowDirectionAny; [self presentViewController:contentController animated:YES completion:nil];
![Page 38: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/38.jpg)
UIPopoverPresentationControllerNew API
contentController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popPC = contentController.popoverPresentationController; popPC.barButtonItem = item; popPC.permittedArrowDirections = UIPopoverArrowDirectionAny; [self presentViewController:contentController animated:YES completion:nil];
![Page 39: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/39.jpg)
UIPopoverPresentationControllerNew API
contentController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popPC = contentController.popoverPresentationController; popPC.barButtonItem = item; popPC.permittedArrowDirections = UIPopoverArrowDirectionAny; [self presentViewController:contentController animated:YES completion:nil];
![Page 40: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/40.jpg)
UIPopoverPresentationControllerNew API
contentController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popPC = contentController.popoverPresentationController; popPC.barButtonItem = item; popPC.permittedArrowDirections = UIPopoverArrowDirectionAny; [self presentViewController:contentController animated:YES completion:nil];
![Page 41: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/41.jpg)
UIPopoverPresentationControllerNew API
contentController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popPC = contentController.popoverPresentationController; popPC.barButtonItem = item; popPC.permittedArrowDirections = UIPopoverArrowDirectionAny; [self presentViewController:contentController animated:YES completion:nil];
![Page 42: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/42.jpg)
DemoAdaptive popovers
![Page 43: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/43.jpg)
UIPopoverPresentationControllerFullscreen adaptation
contentController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popPC = contentController.popoverPresentationController; popPC.barButtonItem = item; popPC.permittedArrowDirections = UIPopoverArrowDirectionAny; !
[self presentViewController:contentController animated:YES completion:nil];
P
![Page 44: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/44.jpg)
UIPopoverPresentationControllerFullscreen adaptation
contentController.modalPresentationStyle = UIModalPresentationPopover; UIPopoverPresentationController *popPC = contentController.popoverPresentationController; popPC.barButtonItem = item; popPC.permittedArrowDirections = UIPopoverArrowDirectionAny; popPC.delegate = self; !
[self presentViewController:contentController animated:YES completion:nil];
P
![Page 45: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/45.jpg)
UIPopoverPresentationControllerFullscreen adaptation
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller { return UIModalPresentationFullScreen; }
P
![Page 46: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/46.jpg)
UIPopoverPresentationControllerFullscreen adaptation
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller { return UIModalPresentationFullScreen; } !
- (UIViewController *)presentationController:(UIPresentationController *)controller viewControllerForAdaptivePresentationStyle:(UIModalPresentationStyle)style { UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller.presentedViewController]; return navController; }
P
![Page 47: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/47.jpg)
Alerts and Action SheetsUIAlertView and UIActionSheet
![Page 48: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/48.jpg)
Alerts and Action SheetsUIAlertView and UIActionSheet
![Page 49: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/49.jpg)
Alerts and Action SheetsUIAlertView and UIActionSheet
Used to be plain views
![Page 50: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/50.jpg)
Alerts and Action SheetsUIAlertView and UIActionSheet
Used to be plain views
New window for presentation
![Page 51: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/51.jpg)
Alerts and Action SheetsUIAlertView and UIActionSheet
Used to be plain views
New window for presentation
Predate modern language features
![Page 52: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/52.jpg)
Alerts and Action SheetsOld alerts presentation
![Page 53: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/53.jpg)
Alerts and Action SheetsOld alerts presentation
App Content
![Page 54: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/54.jpg)
Alerts and Action SheetsOld alerts presentation
App ContentAlert Window
![Page 55: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/55.jpg)
Alerts and Action SheetsOld alerts presentation
App Content
Aler
t Win
dow
![Page 56: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/56.jpg)
Alerts and Action SheetsOld alerts presentation
App Content
Aler
t Win
dow
![Page 57: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/57.jpg)
Alerts and Action SheetsOld alerts presentation
App Content
Aler
t Win
dow
![Page 58: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/58.jpg)
UIAlertController
![Page 59: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/59.jpg)
UIAlertController
Used for alerts and action sheets
![Page 60: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/60.jpg)
UIAlertController
Used for alerts and action sheets
Block based
![Page 61: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/61.jpg)
UIAlertController
Used for alerts and action sheets
Block based
Presents in your window
![Page 62: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/62.jpg)
UIAlertController
Used for alerts and action sheets
Block based
Presents in your window
Action sheets adapt to popovers
![Page 63: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/63.jpg)
UIAlertControllerNew API
UIAlertController* sheet = [UIAlertController alertControllerWithTitle:...]; [sheet addAction:[UIAlertAction actionWithTitle:@“Reply” style:UIAlertActionStyleDefault handler:^void (UIAlertAction *action) { // do stuff }]; !
[self presentViewController:sheet...];
![Page 64: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/64.jpg)
UIAlertControllerNew API
UIAlertController* sheet = [UIAlertController alertControllerWithTitle:...]; [sheet addAction:[UIAlertAction actionWithTitle:@“Reply” style:UIAlertActionStyleDefault handler:^void (UIAlertAction *action) { // do stuff }]; !
[self presentViewController:sheet...];
![Page 65: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/65.jpg)
UIAlertControllerNew API
UIAlertController* sheet = [UIAlertController alertControllerWithTitle:...]; [sheet addAction:[UIAlertAction actionWithTitle:@“Reply” style:UIAlertActionStyleDefault handler:^void (UIAlertAction *action) { // do stuff }]; !
[self presentViewController:sheet...];
![Page 66: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/66.jpg)
UIAlertControllerNew API
UIAlertController* sheet = [UIAlertController alertControllerWithTitle:...]; [sheet addAction:[UIAlertAction actionWithTitle:@“Reply” style:UIAlertActionStyleDefault handler:^void (UIAlertAction *action) { // do stuff }]; !
[self presentViewController:sheet...];
![Page 67: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/67.jpg)
SearchUISearchDisplayController
![Page 68: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/68.jpg)
SearchUISearchDisplayController
![Page 69: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/69.jpg)
SearchUISearchDisplayController
![Page 70: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/70.jpg)
SearchUISearchDisplayController
Limited configurability
![Page 71: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/71.jpg)
SearchUISearchDisplayController
Limited configurability
Ambiguous intent
![Page 72: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/72.jpg)
SearchUISearchDisplayController
Limited configurability
Ambiguous intent
“Presented” via addSubview:
![Page 73: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/73.jpg)
SearchUISearchDisplayController
Limited configurability
Ambiguous intent
“Presented” via addSubview:
Search Bar
![Page 74: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/74.jpg)
SearchUISearchDisplayController
Limited configurability
Ambiguous intent
“Presented” via addSubview:
Search Content
Search Bar
![Page 75: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/75.jpg)
SearchUISearchDisplayController
Limited configurability
Ambiguous intent
“Presented” via addSubview:
Search Content
Search Bar
![Page 76: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/76.jpg)
UISearchController
![Page 77: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/77.jpg)
UISearchController
Replaces UISearchDisplayController
![Page 78: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/78.jpg)
UISearchController
Replaces UISearchDisplayController
Any presenting controller
![Page 79: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/79.jpg)
UISearchController
Replaces UISearchDisplayController
Any presenting controller
Decoupled results
![Page 80: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/80.jpg)
UISearchController
Replaces UISearchDisplayController
Any presenting controller
Decoupled results
Search bar animation
![Page 81: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/81.jpg)
UISearchController
Replaces UISearchDisplayController
Any presenting controller
Decoupled results
Search bar animation
Adaptivity
![Page 82: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/82.jpg)
UISearchController
Replaces UISearchDisplayController
Any presenting controller
Decoupled results
Search bar animation
Adaptivity
More control, fewer assumptions
![Page 83: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/83.jpg)
UISearchDisplayControllerOld API
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero]; UISearchDisplayController *searchController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; searchController.searchResultsDataSource = self; searchController.searchResultsDelegate = self; self.tableView.tableHeaderView = searchController.searchBar;
![Page 84: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/84.jpg)
UISearchControllerNew API
MyResultsController *resultsController = [[MyResultsController alloc] init]; !
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:resultsController]; searchController.searchResultsUpdater = resultsController; self.tableView.tableHeaderView = searchController.searchBar; self.definesPresentationContext = YES;
![Page 85: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/85.jpg)
UISearchControllerNew API
MyResultsController *resultsController = [[MyResultsController alloc] init]; !
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:resultsController]; searchController.searchResultsUpdater = resultsController; self.tableView.tableHeaderView = searchController.searchBar; self.definesPresentationContext = YES;
![Page 86: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/86.jpg)
UISearchControllerNew API
MyResultsController *resultsController = [[MyResultsController alloc] init]; !
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:resultsController]; searchController.searchResultsUpdater = resultsController; self.tableView.tableHeaderView = searchController.searchBar; self.definesPresentationContext = YES;
![Page 87: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/87.jpg)
UISearchControllerNew API
MyResultsController *resultsController = [[MyResultsController alloc] init]; !
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:resultsController]; searchController.searchResultsUpdater = resultsController; self.tableView.tableHeaderView = searchController.searchBar; self.definesPresentationContext = YES;
![Page 88: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/88.jpg)
UISearchControllerNew API
MyResultsController *resultsController = [[MyResultsController alloc] init]; !
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:resultsController]; searchController.searchResultsUpdater = resultsController; self.tableView.tableHeaderView = searchController.searchBar; self.definesPresentationContext = YES;
![Page 89: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/89.jpg)
UISearchControllerNew API
MyResultsController *resultsController = [[MyResultsController alloc] init]; !
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:resultsController]; searchController.searchResultsUpdater = resultsController; self.tableView.tableHeaderView = searchController.searchBar; self.definesPresentationContext = YES;
![Page 90: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/90.jpg)
Search Results
Tab Bar
Search Bar
UISearchControllerNew API
Table View Controller
Navigation Bar
Tab Bar
Search Bar
![Page 91: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/91.jpg)
Search Results
Tab Bar
Search Bar
UISearchControllerNew API
Table View Controller
Navigation Bar
Tab Bar
Search Bar
![Page 92: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/92.jpg)
UISearchControllerNew API
Search Results
Tab Bar
Search Bar
Table View Controller
Navigation Bar
Tab Bar
Search Bar
![Page 93: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/93.jpg)
UISearchControllerNew API
Search Results
Search Bar
Table View Controller
Navigation Bar
Tab Bar
Search Bar
![Page 94: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/94.jpg)
UIPresentationControllerBenefits
![Page 95: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/95.jpg)
UIPresentationControllerBenefits
Controllers all the way down
![Page 96: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/96.jpg)
UIPresentationControllerBenefits
Controllers all the way down
Content and chrome abstraction
![Page 97: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/97.jpg)
UIPresentationControllerBenefits
Controllers all the way down
Content and chrome abstraction
Adaptivity
![Page 98: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/98.jpg)
DemoLet’s build something new
![Page 99: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/99.jpg)
Presenting the Overlay View ControllerMain view controller
OverlayViewController* overlay = [[OverlayViewController alloc] init]; [overlay setPhoto:photo]; !
[self presentViewController:overlay animated:YES completion:NULL];
P
![Page 100: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/100.jpg)
Presenting the Overlay View ControllerMain view controller
OverlayViewController* overlay = [[OverlayViewController alloc] init]; [overlay setPhoto:photo]; !
[self presentViewController:overlay animated:YES completion:NULL];
P
![Page 101: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/101.jpg)
Root View Controller
![Page 102: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/102.jpg)
Root View ControllerOverlay View Controller
![Page 103: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/103.jpg)
Root View Controller
![Page 104: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/104.jpg)
Root View Controller Overlay View Controller
![Page 105: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/105.jpg)
Customizing the Overlay Presentation
Root View Controller Overlay View Controller
Transitioning Delegate
![Page 106: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/106.jpg)
Customizing the Overlay Presentation
Root View Controller Overlay View Controller
Transitioning Delegate
Animator Object
![Page 107: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/107.jpg)
Customizing the Overlay Presentation
Root View Controller Overlay View Controller
Transitioning Delegate
Animator Object Presentation Controller
![Page 108: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/108.jpg)
Customizing the Overlay PresentationRoot view controller
transitionDelegate = [[OverlayTransitioningDelegate alloc] init]; [overlayViewController setTransitioningDelegate:transitionDelegate];
P
![Page 109: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/109.jpg)
Customizing the Overlay PresentationRoot view controller
transitionDelegate = [[OverlayTransitioningDelegate alloc] init]; [overlayViewController setTransitioningDelegate:transitionDelegate];
P
![Page 110: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/110.jpg)
OVCCustomizing the Overlay PresentationOverlay view controller
[self setModalPresentationStyle:UIModalPresentationCustom];
![Page 111: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/111.jpg)
Customizing the Overlay PresentationProviding a custom UIPresentationController
- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source { return [[OverlayPresentationController alloc] initWithPresentingViewController:presenting presentedViewController:presented]; }
TD
![Page 112: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/112.jpg)
Customizing the Overlay PresentationPresentation controller animations
- (void)presentationTransitionWillBegin { UIView* containerView = [self containerView]; UIViewController* presentedViewController = [self presentedViewController]; [dimmingView setFrame:[containerView bounds]]; [dimmingView setAlpha:0.0]; !
[containerView insertSubview:dimmingView atIndex:0]; [[presentedViewController transitionCoordinator] animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { [dimmingView setAlpha:1.0]; } completion:nil]; }
PC
![Page 113: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/113.jpg)
Customizing the Overlay PresentationPresentation controller animations
- (void)presentationTransitionWillBegin { UIView* containerView = [self containerView]; UIViewController* presentedViewController = [self presentedViewController]; [dimmingView setFrame:[containerView bounds]]; [dimmingView setAlpha:0.0]; !
[containerView insertSubview:dimmingView atIndex:0]; [[presentedViewController transitionCoordinator] animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { [dimmingView setAlpha:1.0]; } completion:nil]; }
PC
![Page 114: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/114.jpg)
Customizing the Overlay PresentationPresentation controller animations
- (void)presentationTransitionWillBegin { UIView* containerView = [self containerView]; UIViewController* presentedViewController = [self presentedViewController]; [dimmingView setFrame:[containerView bounds]]; [dimmingView setAlpha:0.0]; !
[containerView insertSubview:dimmingView atIndex:0]; [[presentedViewController transitionCoordinator] animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { [dimmingView setAlpha:1.0]; } completion:nil]; }
PC
![Page 115: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/115.jpg)
Customizing the Overlay PresentationPresentation controller animations
- (void)dismissalTransitionWillBegin { [[[self presentedViewController] transitionCoordinator] animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { [dimmingView setAlpha:0.0]; } completion:nil]; }
PC
![Page 116: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/116.jpg)
Root View Controller
![Page 117: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/117.jpg)
Root View Controller
![Page 118: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/118.jpg)
Customizing the Overlay PresentationTransitioning delegate animations
- (id <UIViewControllerAnimatedTransitioning>) animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source { OverlayAnimatedTransitioning *animationController = [[OverlayAnimatedTransitioning alloc] init]; return animationController; }
TD
![Page 119: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/119.jpg)
Customizing the Overlay PresentationTransitioning delegate animations
- (id <UIViewControllerAnimatedTransitioning>) animationControllerForDismissedController:(UIViewController *)dismissed { OverlayAnimatedTransitioning *animationController = [[OverlayAnimatedTransitioning alloc] init]; return animationController; }
TD
![Page 120: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/120.jpg)
Customizing the Overlay PresentationPresented view controller sizing
- (CGSize)sizeForChildContentContainer:(id <UIContentContainer>)container withParentContainerSize:(CGSize)parentSize { return CGSizeMake(floorf(parentSize.width / 3.0), parentSize.height); }
PC
![Page 121: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/121.jpg)
Customizing the Overlay PresentationPresented view controller sizing
- (CGRect)frameOfPresentedViewInContainerView { CGRect presentedViewFrame = CGRectZero; CGRect containerBounds = [[self containerView] bounds]; presentedViewFrame.size = [self sizeForChildContentContainer:(UIView<UIContentContainer> *)[self presentedView] withParentContainerSize:containerBounds.size]; presentedViewFrame.origin.x = containerBounds.size.width - presentedViewFrame.size.width; return presentedViewFrame; }
PC
![Page 122: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/122.jpg)
Root
Vie
w C
ontr
olle
rO
verla
y Vi
ew
Cont
rolle
r
Root View Controller Overlay View Controller
![Page 123: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/123.jpg)
Root View Controller Overlay View Controller
Root View Controller
Overlay View
Controller
![Page 124: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/124.jpg)
Root View Controller
Overlay View
Controller
Root View Controller Overlay View ControllerRoot View Controller Overlay View Controller
![Page 125: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/125.jpg)
Customizing the Overlay PresentationAdding rotation support
- (void)containerViewWillLayoutSubviews { [dimmingView setFrame:[[self containerView] bounds]]; [[self presentedView] setFrame:[self frameOfPresentedViewInContainerView]]; }
PC
![Page 126: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/126.jpg)
Customizing the Overlay PresentationAdding rotation support
- (void)containerViewWillLayoutSubviews { [dimmingView setFrame:[[self containerView] bounds]]; [[self presentedView] setFrame:[self frameOfPresentedViewInContainerView]]; }
PC
![Page 127: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/127.jpg)
UIContentContainer
![Page 128: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/128.jpg)
UIContentContainer
UIViewController
![Page 129: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/129.jpg)
UIContentContainer
UIViewController
UIPresentationController
![Page 130: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/130.jpg)
UIContentContainer
UIViewController
UIPresentationController
Environment changes
![Page 131: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/131.jpg)
UIContentContainerTransitioning to size
![Page 132: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/132.jpg)
UIContentContainerTransitioning to size
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
![Page 133: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/133.jpg)
UIContentContainerTransitioning to size
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator- (CGSize)sizeForChildContentContainer:(id <UIContentContainer>)container withParentContainerSize:(CGSize)parentSize
![Page 134: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/134.jpg)
UIContentContainerTransitioning to size
![Page 135: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/135.jpg)
UIContentContainerTransitioning to size
!Root
Controller
Child 2
Child 1
![Page 136: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/136.jpg)
UIContentContainerTransitioning to size
[root presentViewController:presented …];
!Root
Controller Presented Controller
Child 2
Child 1
![Page 137: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/137.jpg)
UIContentContainerTransitioning to size
[root presentViewController:presented …];
!Root
Controller Presented Controller
Presentation Controller
Child 2
Child 1
![Page 138: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/138.jpg)
!Root
Controller
UIContentContainerTransitioning to size
Presented Controller
Presentation Controller
Child 2
Child 1
![Page 139: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/139.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
![Page 140: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/140.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
![Page 141: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/141.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
![Page 142: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/142.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
[Root sizeForChildContentContainer:Child1 withParentContainerSize:size]
![Page 143: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/143.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
[Root sizeForChildContentContainer:Child2 withParentContainerSize:size]
![Page 144: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/144.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
![Page 145: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/145.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
[Presentation sizeForChildContentContainer:Presented withParentContainerSize:size]
![Page 146: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/146.jpg)
!Root
Controller
UIContentContainerTransitioning to size
viewWillTransitionToSize:withTransitionCoordinator:
Presented Controller
Presentation Controller
Child 2
Child 1
![Page 147: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/147.jpg)
UIContentContainerPreferred content size
![Page 148: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/148.jpg)
UIContentContainerPreferred content size
@property (nonatomic, readonly) CGSize preferredContentSize
![Page 149: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/149.jpg)
UIContentContainerPreferred content size
@property (nonatomic, readonly) CGSize preferredContentSize
- (void)preferredContentSizeDidChangeForChildContentContainer:(id <UIContentContainer>)container
![Page 150: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/150.jpg)
UIContentContainerPreferred content size
!Root
Controller Presented Controller
Presentation Controller
Child 2
Child 1
![Page 151: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/151.jpg)
UIContentContainerPreferred content size
setPreferredContentSize:
!Root
Controller Presented Controller
Presentation Controller
Child 2
Child 1
![Page 152: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/152.jpg)
UIContentContainerPreferred content size
preferredContentSizeDidChangeForChildContentContainer:
!Root
Controller Presented Controller
Presentation Controller
Child 2
Child 1
![Page 153: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/153.jpg)
UIContentContainerPreferred content size
viewWillTransitionToSize:withTransitionCoordinator:
!Root
Controller Presented Controller
Presentation Controller
Child 2
Child 1
![Page 154: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/154.jpg)
UIContentContainerPreferred content size
!Root
ControllerPresented Controller
Presentation Controller
Child 2
Child 1
![Page 155: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/155.jpg)
UIContentContainerTrait collections
![Page 156: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/156.jpg)
UIContentContainerTrait collections
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
![Page 157: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/157.jpg)
Trait Collections
@property (nonatomic, readonly) UIUserInterfaceSizeClass horizontalSizeClass; @property (nonatomic, readonly) UIUserInterfaceSizeClass verticalSizeClass; @property (nonatomic, readonly) UIUserInterfaceIdiom userInterfaceIdiom; @property (nonatomic, readonly) CGFloat displayScale;
horizontalSizeClass
verticalSizeClass
userInterfaceIdiom
displayScale
![Page 158: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/158.jpg)
Trait Collections
@property (nonatomic, readonly) UIUserInterfaceSizeClass horizontalSizeClass; @property (nonatomic, readonly) UIUserInterfaceSizeClass verticalSizeClass; @property (nonatomic, readonly) UIUserInterfaceIdiom userInterfaceIdiom; @property (nonatomic, readonly) CGFloat displayScale;
horizontalSizeClass Compact
verticalSizeClass
userInterfaceIdiom
displayScale
Regular
Phone
2.0
![Page 159: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/159.jpg)
Responding to Changes
![Page 160: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/160.jpg)
Responding to Changes
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
![Page 161: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/161.jpg)
Responding to Changes
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
![Page 162: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/162.jpg)
Responding to Changes
- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator- (void)containerViewWillLayoutSubviews- (void)viewWillLayoutSubviews
![Page 163: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/163.jpg)
Responding to Changes
![Page 164: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/164.jpg)
Responding to Changes
willTransitionToTraitCollection
![Page 165: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/165.jpg)
Responding to Changes
willTransitionToTraitCollection• Coarse-grain control
![Page 166: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/166.jpg)
Responding to Changes
willTransitionToTraitCollection• Coarse-grain control
• Adaptivity
![Page 167: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/167.jpg)
Responding to Changes
willTransitionToTraitCollection• Coarse-grain control
• Adaptivity
• Screens
![Page 168: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/168.jpg)
Responding to Changes
willTransitionToTraitCollection• Coarse-grain control
• Adaptivity
• Screens
• Auto-hiding status bar
![Page 169: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/169.jpg)
Responding to Changes
![Page 170: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/170.jpg)
Responding to Changes
viewWillTransitionToSize
![Page 171: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/171.jpg)
Responding to Changes
viewWillTransitionToSize• Medium-grain control
![Page 172: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/172.jpg)
Responding to Changes
viewWillTransitionToSize• Medium-grain control
• Child controller size requests
![Page 173: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/173.jpg)
Responding to Changes
viewWillTransitionToSize• Medium-grain control
• Child controller size requests
• Rotation
![Page 174: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/174.jpg)
Responding to Changes
viewWillTransitionToSize• Medium-grain control
• Child controller size requests
• Rotation
• Resizable simulator
![Page 175: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/175.jpg)
Responding to Changes
![Page 176: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/176.jpg)
Responding to Changes
containerViewWillLayoutSubviews and viewWillLayoutSubviews
![Page 177: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/177.jpg)
Responding to Changes
containerViewWillLayoutSubviews and viewWillLayoutSubviews• Fine-grain control
![Page 178: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/178.jpg)
Responding to Changes
containerViewWillLayoutSubviews and viewWillLayoutSubviews• Fine-grain control
• Resize subviews
![Page 179: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/179.jpg)
Responding to Changes
containerViewWillLayoutSubviews and viewWillLayoutSubviews• Fine-grain control
• Resize subviews
• Child container views
![Page 180: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/180.jpg)
DemoAdaptivity and multiple presentation controllers
![Page 181: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/181.jpg)
Adding a New Presentation StyleRoot view controller
transitionDelegate = [[OverlayTransitioningDelegate alloc] init]; [overlayViewController setTransitioningDelegate:transitionDelegate];
P
![Page 182: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/182.jpg)
Adding a New Presentation StyleRoot view controller
if([self presentationShouldBeAwesome]) { transitioningDelegate = [[CoolTransitioningDelegate alloc] init]; } else { transitioningDelegate = [[OverlayTransitioningDelegate alloc] init]; } !
[overlay setTransitioningDelegate:transitioningDelegate];
P
![Page 183: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/183.jpg)
Adding a New Presentation StyleRoot view controller
if([self presentationShouldBeAwesome]) { transitioningDelegate = [[CoolTransitioningDelegate alloc] init]; } else { transitioningDelegate = [[OverlayTransitioningDelegate alloc] init]; } !
[overlay setTransitioningDelegate:transitioningDelegate];
P
![Page 184: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/184.jpg)
Adding a New Presentation StyleRoot view controller
if([self presentationShouldBeAwesome]) { transitioningDelegate = [[CoolTransitioningDelegate alloc] init]; } else { transitioningDelegate = [[OverlayTransitioningDelegate alloc] init]; } !
[overlay setTransitioningDelegate:transitioningDelegate];
P
![Page 185: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/185.jpg)
Summary
![Page 186: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/186.jpg)
Summary
Improved API through UIAlertController and UISearchController
![Page 187: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/187.jpg)
Summary
Improved API through UIAlertController and UISearchController
Presentations are now in your hands
![Page 188: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/188.jpg)
Summary
Improved API through UIAlertController and UISearchController
Presentations are now in your hands• Go make your own Cool Mode!
![Page 189: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/189.jpg)
More Information
Jake Behrens App Frameworks Evangelist [email protected]
Documentation View Controllers and Presentation Controllers http://developer.apple.com
Apple Developer Forums http://devforums.apple.com
![Page 190: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/190.jpg)
Related Sessions
• View Controller Advancements in iOS 8 Mission Wednesday 9:00AM
• Building Adaptive Apps with UIKit Mission Wednesday 10:15AM
• What's New in Interface Builder Mission Wednesday 3:15PM
• Core iOS Application Architectural Patterns Mission Thursday 9:00AM
![Page 191: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/191.jpg)
Labs
• Cocoa Touch Lab Frameworks Lab A Thursday 2:00PM
![Page 192: 228 A Look Inside Presentation Controllers 02 DF€¦ · A Look Inside Presentation Controllers With a case study on alerts and search Session 228 Peter Hajas UIKit Engineer Frameworks!](https://reader033.vdocuments.site/reader033/viewer/2022052022/6037910fd9ec1363591b6c29/html5/thumbnails/192.jpg)