Hello how can i keep integer value from an Array to UILABEL?

Discussion in 'iOS Programming' started by tstechnik, Dec 4, 2014.

  1. tstechnik, Dec 4, 2014
    Last edited by a moderator: Dec 4, 2014

    tstechnik macrumors newbie

    Joined:
    Dec 4, 2014
    #1
    Hello everyone ,
    I need help . how can i integer value from array to UILabel on side by side .

    Example: i have 10 in my integer array , how can I 2 4 5 6 7 8 9 10 so . ? With line works, but not next to each other .
    Code:
        NSInteger rest[32];
        int zahl = myLabel.text.intValue;
        int count = 0;
        bool go = true;
        
        NSString *string = @"";
        
        if (go == true) {
            for (int i = 0; i < 32; i++) {
                rest[i] = zahl % 2;
                zahl = zahl / 2;
                count ++;
                myLabel.numberOfLines=2;
                string = [string stringByAppendingFormat:@"%li \n", (long)rest[i]];
                if (zahl == 0) {
                    while (count > 0) {
                        NSLog(@"%li", (long)rest[count - 1]);
                        count--;
                    }
                    
                    myLabel.text = string;
                    break;
                }
            }


    ----------

    Hello everyone ,
    I need help . how can i integer value from array to UILabel on side by side .

    Example: i have 10 in my integer array , how can I 2 4 5 6 7 8 9 10 so . ? With line works, but not next to each other .
     
  2. grandM macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #2
    I didn't test your code but if it works you probably just have to delete the \n. You could also have used stringByAppendingString by the way.
     
  3. tstechnik thread starter macrumors newbie

    Joined:
    Dec 4, 2014
    #3
    Hi

    Fine thank you, i dont see "\n". I have remove "\", my code is working.
     

Share This Page