Daniel Rahamim
Daniel Rahamim

Reputation: 315

UINavigationController custom transition animation view controller alpha value

I want to make a transition, that in the end, the ToViewController alpha value will be something like 0.7, so the user still be able to see the FromViewController" at the background.

Why am I doing it? because at the end of transition I need to remove the FromViewController.

Upvotes: 0

Views: 135

Answers (1)

Rohit Jha
Rohit Jha

Reputation: 21

An easy way is to take snapshot of the view controller at run time and navigate your desired controller with passing snapshot image and make it a background image of ToView Controller, so it will look like you are on a same page.

-(UIImage *)takeSnapshot:(UIView *)snapView {

    UIGraphicsBeginImageContextWithOptions(snapView.frame.size, NO, [UIScreen mainScreen].scale);

    [snapView drawViewHierarchyInRect:snapView.bounds afterScreenUpdates:NO];

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

Upvotes: 1

Related Questions