Question

I know its mad but here it goes:

i load a splashView to my app: on viewDidLoad:

[self.view addSubview:splashView];    

UIViewAnimationOptions options = UIViewAnimationOptionCurveLinear;
[UIView animateWithDuration:0.5 delay:3.0 options:options animations:^{            
    splashView.alpha = 0.0f;
    splashView.frame = CGRectMake(512,384,-10,-10);
}

completion:^(BOOL finished){                          
    [splashView removeFromSuperview]; 
}];

Nothing special to the code here.

however, when i try to load the same view as an action through a button NOTHING happens:

-(IBAction)showSplash:(id)sender {
    [self.view addSubview:splashView];

    UIViewAnimationOptions options = UIViewAnimationOptionCurveLinear;
    [UIView animateWithDuration:0.5 delay:3.0 options:options animations:^{
        splashView.alpha = 0.0f;
        splashView.frame = CGRectMake(512,384,-10,-10);
    }

    completion:^(BOOL finished){ 
        [splashView removeFromSuperview]; 
    }];
}

why is this happening?

By the way if i DO NOT load the splashView on the viewDidLoad and then use the button (action) it works ok!

is this normal behavior?

Was it helpful?

Solution

Reset the alpha value before fading the splash view out.

splashView.alpha = 1.0f;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top