Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

8.1. Accepting user actions

The simplest way to accept new data from a user is through UIControls, a topic that we covered in some depth in the latter half of chapter 6 and that we’re looking at again here for the sake of completeness. Table 8.1 includes some notes on the controls that you can use to accept user input.

Table 8.1. Various controls allow you to accept user input, most using simple interfaces.
ControlSummary
UIButtonOffers simple functionality when the user clicks a button. See section 6.5 for an example.
UIPageControlA pure navigation object that allows users to move between multiple pages using a trio of dots.
UIPickerViewNot a UIControl object, but allows the user to select from a number of items in a “slot machine” selection. It includes the subclass UIDatePicker.
UISearchBarNot a UIControl object, but offers similar functionality to a UITextField. It provides an interface that includes a single-line text input, a search button, a cancel button, and a bookmark button. See section 9.1.3 for an example.
UISegmentedControlA horizontal bar containing several buttons. See section 10.4.2 for an example.
UISliderA slider that allows users to input from a range of approximate values. See section 6.6.2 for an example.
UISwitchAn on-off button of the sort used in preferences. See section 8.2.1 for an example.
UITextFieldA single-line text input, and probably the most common control for true user input. It requires some work to make the keyboard relinquish control. See section 6.6.1 for complete discussion and an example.
UITextViewNot a UIControl object, but does allow the user to enter longer bits of text. As with a text field, you must have it resignFirstResponder status to return control to the program when the user has finished typing. As shown in the iPhone Notes utility, this is typically done with a separate Done button at the top of the interface, because the Return key is used to input returns. See section 8.3.4 for an example.
UIToolBarNot a UIControl object. Instead, it’s a bar meant to hold a collection of UIBarButtonItems, each of which can be clicked to initiate an action. The bar is easy to configure and change. See section 11.4 for an example.



  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint