Code Monkey home page Code Monkey logo

agblurtransition's People

Contributors

angelolloqui avatar jstart avatar maxmamis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

agblurtransition's Issues

Bug when using AGBlurTransition in Landscape

The AGBlurTransition is awesome but i need it in Landscape.
When using in Landscape it dosen't work correct. The 'popover' View is not centered and the Screenshot in the Back is rotated by 90°. Please Fix it, or tell me how does it work.

From my Project
ios simulator bildschirmfoto 19 05 2014 11 54 51

From your Demo
ios simulator bildschirmfoto 19 05 2014 17 23 26

Swift port

Here is a simplified .swift port to use with storyboards

import UIKit

@objc(InsetBlurModalSeque) class InsetBlurModalSeque: UIStoryboardSegue {

override func perform() {
    let sourceViewController = self.sourceViewController as UIViewController
    let destinationViewController = self.destinationViewController as UIViewController

    // Make sure the background is ransparent
    destinationViewController.view.backgroundColor = UIColor.clearColor()

    // Take screenshot from source VC
    UIGraphicsBeginImageContext(sourceViewController.view.bounds.size)
    sourceViewController.view.drawViewHierarchyInRect(sourceViewController.view.frame, afterScreenUpdates:true)
    var image:UIImage = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()

    // Blur screenshot
    var blurredImage:UIImage = image.applyBlurWithRadius(5, tintColor: UIColor(white: 1.0, alpha: 0.0), saturationDeltaFactor: 1.3, maskImage: nil)

    // Crop screenshot, add to view and send to back
    let blurredBackgroundImageView : UIImageView = UIImageView(image:blurredImage)
    blurredBackgroundImageView.clipsToBounds = true;
    blurredBackgroundImageView.contentMode = UIViewContentMode.Center
    let insets:UIEdgeInsets = UIEdgeInsetsMake(20, 20, 20, 20);
    blurredBackgroundImageView.frame = UIEdgeInsetsInsetRect(blurredBackgroundImageView.frame, insets)

    destinationViewController.view.addSubview(blurredBackgroundImageView)
    destinationViewController.view.sendSubviewToBack(blurredBackgroundImageView)

    // Add original screenshot behind blurred image
    let backgroundImageView : UIImageView = UIImageView(image:image)
    destinationViewController.view.addSubview(backgroundImageView)
    destinationViewController.view.sendSubviewToBack(backgroundImageView)

    // Add the destination view as a subview, temporarily – we need this do to the animation
    sourceViewController.view.addSubview(destinationViewController.view)

    // Set initial state of animation
    destinationViewController.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.1, 0.1);
    blurredBackgroundImageView.alpha = 0.0;
    backgroundImageView.alpha = 0.0;

    // Animate
    UIView.animateWithDuration(0.5,
        delay: 0.0,
        usingSpringWithDamping: 0.6,
        initialSpringVelocity: 0.0,
        options: UIViewAnimationOptions.CurveLinear,
        animations: {
            destinationViewController.view.transform = CGAffineTransformIdentity
            blurredBackgroundImageView.alpha = 1.0
            backgroundImageView.alpha = 1.0;

        },
        completion: { (fininshed: Bool) -> () in
            // Remove from temp super view
            destinationViewController.view.removeFromSuperview()

            sourceViewController.presentViewController(destinationViewController, animated: false, completion: nil)
        }
    )

}

}

Error with iOS8

xCode throws an error at Line 122:

[parent addSubview:self.backgroundView];

exception 'NSInvalidArgumentException', reason: 'Can't add self as subview'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.