0

I am trying to direct the user to a new scene if he enters a correct code, but it does not work. Here is the code:

- (void)showCodes:(id)sender {
    alert = [[UIAlertView alloc] initWithTitle:@"Codes" message:@"Enter a code." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Enter", nil];
    code = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)];
    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60);
    [alert setTransform:myTransform];

    [code setBackgroundColor:[UIColor whiteColor]];
    [alert addSubview:code];
    [alert show];
    [code retain];
}

- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
    NSString *text = code.text;
    NSString *othermode;
    bernierMode = @"epicmode";
    if (text == nil) {
        //nothing
    }
    else if(text == othermode)
    {
        //go to other view...
    }
    else {

    }
}
}

I am using cocos2D (don't think that makes a difference) in my header file, I also set the UIAlertView Delegate.

Thanks,

Tate

tallen11
  • 1,387
  • 2
  • 17
  • 33

1 Answers1

0

Gaming - Stack Exchange will be a better site for you. That site is specific to all of your gaming code needs.

Community
  • 1
  • 1
WrightsCS
  • 50,551
  • 22
  • 134
  • 186