Home > Articles > Web Development

  • Print
  • + Share This
This chapter is from the book

Workshop

Quiz

  1. What class is a toolbar button?

  2. How do you set where a popover appears?

  3. Why do we need to compare the popover controller to nil before initializing it?

Answers

  1. A toolbar button is an instance of the bizarrely named class UIBarButtonItem.
  2. 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.
  3. 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

  1. 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.

  2. 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.

  • + Share This
  • 🔖 Save To Your Account