O'Reilly logo

The Complete Idiot's Guide® To iPad and iPhone App Development by Troy Brant

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Computing the Tip

Now, let’s add some logic for computing the tip, total price, and price of the meal per person.
Add the following code just below your @synthesize directives in TiptacularViewController.m:
186
187
As you can see, you get the values from the text fields, use them to compute the tip totals, and update the display labels with the computed values. Some parts of the code require a little more explanation, though:
• Notice how you can mix and match dot-syntax with messaging syntax. On the first line of code, you access checkAmountTextField’s ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required