SUMMARY

This chapter explored the roles played by outlets and actions in an iPhone application. Outlets and actions are the cornerstone of iOS development, so understanding theiruse is extremely important. Throughout this book, you will come across them frequently. You have also seen the use of some of the commonly used views in the Library.

In the next chapter, you learn about the various types of View controllers supported by the iOS SDK, and how you can use them to build different types of iPhone and iPad applications.

EXERCISES

  1. Declare and define an outlet for a UITextField view using code.
  2. Declare and define an action using code.
  3. When do you use an alert view and when do you use an action sheet?
  4. Create a UIButton from code and wire its Touch Up Inside event to an event handler.

    Answers to the exercises can be found in Appendix D.

image WHAT YOU LEARNED IN THIS CHAPTER

TOPIC KEY CONCEPTS
Action An action is a method that can handle events raised by views (for example, when a button is clicked, etc.) in the View window.
Outlet An outlet allows your code to programmatically reference a view on the View window.
Adding outlet using code Use the IBOutlet keyword: IBOutlet UITextField *txtName;
Adding action using code Use the IBAction keyword: (IBAction) btnClicked:(id) sender;
Connecting actions To link actions, you commonly drag from the view in the View window onto ...

Get Beginning iOS 5 Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.