lundi 9 novembre 2015

Console Printing Else If (objective-c) (iOS)

I have a textfield that prints it's text into the console, now I want to create a else if statement, what ever the textfield prints into the console, some code will run.

Here is my code for the text field, and nslog, that prints the text into the console.

 self.heardTextView.text = [NSString stringWithFormat:@"Heard: \"%@\"", hypothesis]; // Show it in the status box.

    // Logging text into console
    NSLog(@" the text is %@", self.heardTextView.text);

Here is a 'else if' i created but it doesn't work. So when @"ROTATE" is in the text field, it will run this code.. But it's not running.

-(void) perform: (NSString *) command {
    if([command caseInsensitiveCompare:@"ROTATE"] == NSOrderedSame) // Command Rotate
    {
        [pattern decreaseAngle];
        int f = [pattern getAngle];
        [self changeAngle:(f)];
    }

Aucun commentaire:

Enregistrer un commentaire