Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

MPG Calculator

programmer190programmer190 Posts: 8New Users
edited December 2012 in iOS SDK Development
How do you create an MPG Calculator in Xcode.
Post edited by programmer190 on

Replies

  • programmer190programmer190 Posts: 8New Users
    Does anyone know to fix it ARGENT :)
  • Duncan CDuncan C Posts: 9,114Tutorial Authors, Registered Users @ @ @ @ @ @ @
    This is very basic programming, and not very specific to Xcode.

    Create a project using the single view template.

    Add 2 input fields (UITextField objects). Label one miles driven, and the other gas used.

    Add an output field (UITextField with it's enabled flag set to false) and label that one MPG.

    Hook up outlets to all 3 fields.

    Add a "Calculate MPG" button. Hook that to a "calculateMPG" action. In the action, get the floatValue of your milesDriven and gasUsed fields, divide milesDriven by gasUsed, and save the result to your calculatedMPG output field.

    You may need to poke around on the internet for some tutorials on how to use Interface Builder to create fields and connect up outlets and actions. I'm not going to spoon-feed you every little detail you need.
    Regards,
    Duncan C
    WareTo

    widehead.gif
    Animated GIF created with Face Dancer, available for free in the app store.

    I'm available for one-on-one help at CodeMentor
  • programmer190programmer190 Posts: 8New Users
    Thanks I searched the internet and fixed my issue. THANKS :)
  • Duncan CDuncan C Posts: 9,114Tutorial Authors, Registered Users @ @ @ @ @ @ @

    Thanks I searched the internet and fixed my issue. THANKS :)

    Ok then. Fixed what issue? Your first post asked how to create an MPG calculator. Your second post in this thread asked "Does anyone know to fix it ARGENT".

    Fix what?

    For future reference, inarticulate posts like that with no details don't tend to get many answers. Next time, try to post a complete description of what you're trying to do, what, exactly, is going wrong, and what you've tried to fix it.

    Regards,
    Duncan C
    WareTo

    widehead.gif
    Animated GIF created with Face Dancer, available for free in the app store.

    I'm available for one-on-one help at CodeMentor
Sign In or Register to comment.