                 }
             }
         }
-        
-    }
-    
+
+    }
+
     private func imageFromCaptureLayer() -> UIImage {
         UIGraphicsBeginImageContext(captureLayer.frame.size)
         captureLayer.renderInContext(UIGraphicsGetCurrentContext()!)

            imageView.image = image
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = ImagePickerViewController.bgColor
        imageView.contentMode = .ScaleAspectFit
        
        imageView.translatesAutoresizingMaskIntoConstraints = false
        addSubview(imageView)
        
        addConstraint(NSLayoutConstraint(item: imageView, attribute: .Left, relatedBy: .Equal, toItem: self, attribute: .Left, multiplier: 1.0, constant: 0))
        addConstraint(NSLayoutConstraint(item: imageView, attribute: .Right, relatedBy: .Equal, toItem: self, attribute: .Right, multiplier: 1.0, constant: 0))
        addConstraint(NSLayoutConstraint(item: imageView, attribute: .Top, relatedBy: .Equal, toItem: self, attribute: .Top, multiplier: 1.0, constant: 0))
        addConstraint(NSLayoutConstraint(item: imageView, attribute: .Bottom, relatedBy: .Equal, toItem: self, attribute: .Bottom, multiplier: 1.0, constant: 0))
        
        layoutIfNeeded()
    }
    
    override func preferredLayoutAttributesFittingAttributes(layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
        let attr = UICollectionViewLayoutAttributes()
        let imageSize = imageView.image!.size

            self.collectionView.registerClass(CameraCell.self, forCellWithReuseIdentifier: CameraCell.reuseIdentifier)
            self.view.backgroundColor = UIColor.clearColor()
            self.backgroundView.addGestureRecognizer(UITapGestureRecognizer(target: self, action:"onOutsideTap"))

            self.pickerContainer.addSubview(self.collectionView)
        }
    }

    ///////////////////////////////////////
    //  CollectionView
    ///////////////////////////////////////

    public func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 2
    }

    public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        switch(section){
        case 0:
