views:

193

answers:

0

I have two views and I want to present the second view from a method in the first view. My code works in an IBAction method, but not from one returning void. Is this a known issue, if so is there a workaround?

My code is as follows (I already declared "scores" and -(void)win in FirstViewController.h):

   // In FirstViewController.m
-(void) win {
        scores = [[ScoresViewController alloc] init];
        scores.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        [scores setScore:trueScore];
        [self presentModalViewController:scores animated:YES];
}

To answer the questions being asked below, "win" is called from an IBAction:

 -(IBAction)yellowButtonPressed {
    NSLog(@"Yellow Button Press");
    if (iteration < 100) {
     //do important things
    } 
    else { 
    [self win];
     }
    }