Creating Objects on the Fly

Discussion in 'iOS Apps' started by tdewitt274, Nov 4, 2012.

  1. tdewitt274 macrumors newbie

    Nov 4, 2012
    Hello All!

    First off, I'd like to put it out there. I'm new to OOP. I mostly do web scripting in my spare time (VBScript and JavaScript). However, a friend of mine suggested that I give creating iPod apps a try. So, here it goes...

    I have a JavaScript page that creates a tracker. For simplification, it takes user input of the Name and Age and sorts it based on Age. To do this, I have a form that allows the user to enter the data and a button to add values to a <div> container (affectionately named "divBody"). Here's a snippet of what the code looks like:

    function PutErThere (txtName,intAge) {
    CurrInfo document.getElementById("divBody");

    CurrInfo.innerHTML += "<span style='width:120;'>"+txtName+"</span>";
    CurrInfo.innerHTML += "<input type='text' style='width:40; text-align:center;' value='"+intAge+"' name='txtVal1'>";
    So, as you can see, it takes the input and creates a "label" and a "text box". So, here's my problem: How do I get these objects to appear on the screen in Objective C?

    I can figure out the rest of the sorting and such by trial and error. But I don't know how to add the fields while the code is running. I understand that the objects can be programmed in on the code side using the XCode program. However, the users can enter more than expected.

    OK, for extra credit, here's another question. I'm sure that once I find an answer to the above question that this may fall into line. In the end, I would like to have a "Person" Object that stores the Name and Age passed. Is it possible to make the Object function like the label and text box as described above? Just a thought.

    Any help is greatly appreciated!


  2. tdewitt274, Nov 4, 2012
    Last edited: Nov 4, 2012

    tdewitt274 thread starter macrumors newbie

    Nov 4, 2012
    Just noticed I may have put this in the wrong forum.

    Moderator, please delete as appropriate.


Share This Page