Workshop
Quiz
-
What class is a toolbar button?
-
How do you set where a popover appears?
-
Why do we need to compare the popover controller to nil before initializing it?
Answers
- A toolbar button is an instance of the bizarrely named class UIBarButtonItem.
- The iPhone OS determines where a popover appears onscreen. Setting the permittedArrowDirections parameter when displaying the popover, however, limits where the OS may position the popover so that it can be drawn with an arrow pointing to the UI element invoking it.
- If the popover controller is not nil, that means the popover is visible onscreen and a new copy of it should not be created.
Activities
-
Explore the possibilities of popovers outside of toolbars. Implement an additional button (UIButton) within the popoverConfig application that displays the same popover, but located in the center of the screen.
-
Implement a second toolbar-based popover within the popoverConfig application. If you choose to use a single delegate for each, you can check to see which popover is being dismissed by comparing each controller instance variable to the controller variable passed to the popoverControllerDidDismissPopover method.