2 Replies - 2427 Views - Last Post: 11 September 2013 - 02:35 PM

#1 Platnium  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-September 13

how to change text in Uilabel

Posted 09 September 2013 - 01:55 PM



- (void)generate {
    //AI = 1 + arc4random() % 3;
    
    if (AI == 1) {
        if (player == 1) { //if player plays Rock and AI plays Rock
            _Player.text = [CFStringCreateWithFormat: @"ROCK" ];
            _AI.text = [CFStringCreateWithFormat: @"ROCK" ];
        
        } else if (player == 2){ //if player plays paper and AI plays rock
            _Player.text = [CFStringCreateWithFormat: @"PAPER" ];
            _AI.text = [CFStringCreateWithFormat: @"ROCK" ];
            P1 = P1 + 1;
            _P1.text = [CFStringCreateWithFormat: @"%a", P1 ];
        
        } else if(player == 3){
            _Player.text = [CFStringCreateWithFormat: @"SCISSORS" ];
            _AI.text = [CFStringCreateWithFormat: @"ROCK" ];
            P2 = P2 + 1;
            _P2.text = [CFStringCreateWithFormat: @"%a", P2 ];
            
        }
    
    
    } else if (AI == 2){
        if(player == 1){ //if player plays rock and AI plays paper
            _Player.text = [CFStringCreateWithFormat: @"ROCK" ];
            _AI.text = [CFStringCreateWithFormat: @"PAPER" ];
            P2 = P2 + 1;
            _P2.text = [CFStringCreateWithFormat: @"%a", P2 ];
        
        } else if(player == 2){ // if player plays paper and AI plays paper
            _Player.text = [CFStringCreateWithFormat: @"PAPER" ];
            _AI.text = [CFStringCreateWithFormat: @"PAPER" ];
            
        } else if(player == 3){ //if player plays Scissors and AI plays paper
            _Player.text = [CFStringCreateWithFormat: @"SCISSORS" ];
            _AI.text = [CFStringCreateWithFormat: @"PAPER" ];
            P1 = P1 + 1;
            _P1.text = [CFStringCreateWithFormat: @"%a", P1 ];
        }
        
        
        
        
    } else if(AI == 3){
        if(player == 1){ //if player plays rock and AI plays scissors
            _Player.text = [CFStringCreateWithFormat: @"ROCK" ];
            _AI.text = [CFStringCreateWithFormat: @"SCISSORS" ];
            P1 = P1 + 1;
            _P1.text = [CFStringCreateWithFormat: @"%a", P1 ];
            
        } else if(player == 2){ // if player plays paper and AI plays scissors
            _Player.text = [CFStringCreateWithFormat: @"PAPER" ];
            _AI.text = [CFStringCreateWithFormat: @"SCISSORS" ];
            P2 = P2 + 1;
            _P2.text = [CFStringCreateWithFormat: @"%a", P2 ];

        } else if(player == 3){ //if player plays scissors and AI plays scissors
            _Player.text = [CFStringCreateWithFormat: @"SCISSORS" ];
            _AI.text = [CFStringCreateWithFormat: @"SCISSORS" ];
        }
    }

    
    
    
    
    
}





this is what I have so far but the current way to change labels is not working can anyone help

Is This A Good Question/Topic? 0
  • +

Replies To: how to change text in Uilabel

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8401
  • View blog
  • Posts: 31,257
  • Joined: 12-June 08

Re: how to change text in Uilabel

Posted 09 September 2013 - 01:58 PM

... is this objective-c?
Was This Post Helpful? 0
  • +
  • -

#3 Platnium  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-September 13

Re: how to change text in Uilabel

Posted 11 September 2013 - 02:35 PM

Yes it is
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1