0

I have a viewcontroller where I simulate an view on. I have a firstViewController and I have loginViewController. Here is the code how I popup the loginViewontroller on top of the firstViewcontroller.

in firstViewController.m

LoginViewController *login = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:NULL];

        [self presentModalViewController:login animated:YES];

And in loginViewController I have the following function.

-(void)initialDelayEnded {
    self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
    self.view.alpha = 0.0;
    [UIView animateWithDuration:1.0/1.5 animations:^{
        self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
    }completion:^(BOOL complete){
        [UIView animateWithDuration:1.0/2 animations:^{
            self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
        }completion:^(BOOL complete){
            [UIView animateWithDuration:1.0/2 animations:^{
                self.view.transform = CGAffineTransformIdentity;
            }];
        }];
    }];

}

In firstViewcontroller I have a background image. What I want to do now is that loginViewcontroller pops up the image is still visible.

Can anybody help me?

Thanks in advance.

Sarah Geebelen
  • 173
  • 1
  • 9
  • I think you'll definitely have the answer to your question here : http://stackoverflow.com/questions/587681/how-to-use-presentmodalviewcontroller-to-create-a-transparent-view – cwehrung Nov 12 '12 at 13:04
  • what about (alpha) did u try use it. or that not what u mean ? – Omarj Nov 12 '12 at 13:08

1 Answers1

0

You can't see through the viewcontroller stack. The easiest solution would be to pass the background image you have in firstviewcontroller to the second and set it as a background.

Have a property on LoginViewController.h

@property (nonatomic, strong) UIImage* image;

Then when you instantiate the controller

LoginViewController *login = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:NULL];
    login.image = self.backgroundImage; //Set the image to the background image
    [self presentModalViewController:login animated:YES];

Finally, in viewDidLoad of loginViewController.m

 self.view.backgroundColor = [UIColor colorWithPatternImage:self.image];
Chris Mitchelmore
  • 5,976
  • 3
  • 25
  • 33