mpospese / MPFoldTransition

Easily add custom folding and page-flipping transitions to UIViews and UIViewControllers
http://markpospesel.com/2012/05/07/mpfoldtransition/
1.81k stars 238 forks source link

UIViews with transparent backgroundColor #10

Closed fabiocaccamo closed 3 years ago

fabiocaccamo commented 11 years ago

If I use this style: (MPFoldStyleHorizontal | MPFoldStyleUnfold | MPFoldStyleCubic) and 'toView' has a transparent background, the 'fromView' should not be visible (after it has been flipped) behind the 'toView'.

I think a possible solution could be stop to render 'fromView' if it has been flipped: (right < left || top < bottom)


if I use this style: (MPFoldStyleHorizontal | MPFoldStyleUnfold) and 'fromView' has a transparent background, a black background is added to 'fromView' when the transition starts.

This problem is in: [MPAnimation renderImageFromView:...] and can be fixed forcing a non-opaque background if the view.backgroundColor == UIColor clearColor ... (maybe there's a better solution):

UIGraphicsBeginImageContextWithOptions(imageSizeWithBorder, FALSE, 0);


Thanks for this great library.

mpospese commented 11 years ago

I look forward to a pull request with your solutions, thanks!

flodev03 commented 11 years ago

Where do you force the transparent background using view.backgroundColor = [UIColor clearColor]; ??

thanks

fabiocaccamo commented 11 years ago

I set the view background color just after having created it...

pbernery commented 11 years ago

I also needed this and sent a pull request in MPFlipViewController that does it. You can find it here: https://github.com/mpospese/MPFlipViewController/pull/8.

I've done it in MPFlipViewController because this is the project I use.

Note that I needed to set flippingPageShadowOpacity and coveredPageShadowOpacity property to 0 to have a clear transition.