Help with displaying integers

Discussion in 'iOS Programming' started by iphonedevelop18, Mar 2, 2009.

  1. iphonedevelop18
    Expand Collapse
    macrumors member

    Joined:
    Feb 26, 2009
    #1
    int number = 20;

    NSString *labelText = [[NSString alloc] initWithFormat:mad:"%f", number];
    label.text = labelText;
    [labelText release];

    how would I make the text output the integer, it worked with a slider to output the "slider.value" so now i cant get it to output the integer. I think is has something to do with the @"%f" because when you output a string, you use @"%@d".
     
  2. caveman_uk
    Expand Collapse
    Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
  3. dejo
    Expand Collapse
    Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    No, you should be using %@ for strings.
     
  4. caveman_uk
    Expand Collapse
    Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #4
    I just assumed the OP was a bad typist and let that one go....:D
     
  5. dejo
    Expand Collapse
    Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    Based on this thread and others started by the OP, I'm afraid it's more than just bad typing. They don't seem to have a good grasp of even the basics of Objective-C. I feel they would be best served if they stepped back and did some reading and learning about the language and its usage.
     
  6. iphonedevelop18
    Expand Collapse
    thread starter macrumors member

    Joined:
    Feb 26, 2009
    #6
    Thank you for helping me, sorry for asking so many questions, If you could I would like a website that would help me more understand objective c as I have only programmed in a variation of c for robots and other languages.
     
  7. caveman_uk
    Expand Collapse
    Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #7
    The thing is that the question in this thread and in the other one about maths functions are basic bog-standard C. They're not specific to objective C.
     

Share This Page