views:

29

answers:

0

I have navigation controller with 2 view controllers. VC1 calls VC2. Based on button selection VC2 displays VC3 modally. After the display VC2 dismisses VC3. Here is my piece of code.

  1. VC3 has an imageview. Inside VC3 I have logic to display the image based on button selection in VC2. Could it be done in a better way (like moving all the logic to VC2)? Do I have to read from NIB always?
  2. Is there some way to check memory usage as the app is running?

.

-(IBAction)bringNextView:(id)sender
{
    if([[sender currentTitle] isEqualToString:currentLetter.text])
    {

        myThirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];

        myThirdViewController.selectedBtn = btn1;
        myThirdViewController.selectedBtn2 = btn2;
        myThirdViewController.selectedBtn3 = btn3;
        myThirdViewController.selectedBtn4 = btn4;
        myThirdViewController.selectedLetter = [sender currentTitle];
        myThirdViewController.currentLetter = currentLetter;

        myThirdViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController:myThirdViewController animated:YES];
        [self performSelector:@selector(hide) withObject:nil afterDelay:3.0f];
    }
    else {
        NSLog(@"in else");
    } 

}