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
Share this Page URL
Help

2. iOS App Patterns: Hello, Renee! > Use your picker reference to pull the sele...

Use your picker reference to pull the selected values

Now all that’s left is to use our reference to the picker to get the actual values Mike selects. We need to change the sendButtonTapped method to pull the values from the picker. Looking at the UIPickerView documentation, the method we need is selectedRowInComponent:. That method returns a row index we can use as an index into our arrays.

image with no caption

For now we’re just going to log this message to the console so we can see the string we’re building, and then we’ll generate the email to send out in just a minute. Let’s make sure we implemented this correctly first before emailing Renee.

Test Drive

OK, try it out. You should get some convincing text in the console.

image with no caption

Ready Bake Code

To send the email, we’re going to use the messaging API. Rather than go into all the details of the messaging framework right now, we’ll give you the code you need. As you get further in the book, this type of framework will become easy to use. Add the bolded code you see below into the appropriate files, and you’ll be ready to go.


  

You are currently reading a PREVIEW of this book.

                                                                                        

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

  

Start a Free Trial