             if let barButtonItem = sender as? UIBarButtonItem {
                 actionSheet.showFromBarButtonItem(barButtonItem, animated: true)
             } else {
-                actionSheet.showFromRect(popOverPresentRect, inView: self.calculatedViewController().view!, animated: true)
+                actionSheet.showFromRect(popOverPresentRect, inView: topViewController(presentingViewController).view!, animated: true)
             }
         }
         else if let tabBar = self.presentingTabBar {

import MobileCoreServices
import UIKit

public protocol FDTakeDelegate: NSObject {
    /// Delegate method after the user has started a take operation but cancelled it
    optional func takeController(controller: FDTakeController, didCancelAfterAttempting madeAttempt: Bool)

    /// Delegate method after the user has started a take operation but it failed
    optional func takeController(controller: FDTakeController, didFailAfterAttempting madeAttempt: Bool)

    /// Delegate method after the user has successfully taken or selected a photo
    optional func takeController(controller: FDTakeController, gotPhoto photo: UIImage, withInfo info: [NSObject : AnyObject])

    /// Delegate method after the user has successfully taken or selected a video
    optional func takeController(controller: FDTakeController, gotVideo video: NSURL, withInfo info: [NSObject : AnyObject])
}

public class FDTakeController: NSObject /*, UIImagePickerControllerDelegate, UINavigationControllerDelegate */ {

    // MARK: - Properties
    
    /// The delegate to receive updates from FDTake
    public weak var delegate: FDTakeDelegate? = nil
    
    public var allowPhoto = true
    

    
    public var presentingTabBar: UITabBar? = nil
    
    public lazy var presentingViewController: UIViewController = {
        return UIApplication.sharedApplication().keyWindow!.rootViewController!
    }()
    
    
    // MARK: - Callbacks
    
    /// A photo was selected
    public var didGetPhoto: ((photo: UIImage, info: [NSObject : AnyObject]) -> Void)?
    
    /// A video was selected
    public var didGetVideo: ((video: NSURL, info: [NSObject : AnyObject]) -> Void)?
    
    /// The user selected did not attempt to select a photo
    public var didDeny: (() -> Void)?
    
    /// The user started selecting a photo or took a photo and then hit cancel
    public var didCancel: (() -> Void)?
    
    /// A photo or video was selected but the ImagePicker had NIL for EditedImage and OriginalImage
    public var didFail: (() -> Void)?
    
    
    // MARK: - Localization overrides
    
    /// Custom UI text (skips localization)
    public var takePhotoText: String? = nil
    
    /// Custom UI text (skips localization)
    public var takeVideoText: String? = nil
    
    /// Custom UI text (skips localization)
    public var chooseFromLibraryText: String? = nil
    
    /// Custom UI text (skips localization)
    public var chooseFromPhotoRollText: String? = nil
    
    /// Custom UI text (skips localization)
    public var cancelText: String? = nil
    
    /// Custom UI text (skips localization)
    public var noSourcesText: String? = nil
    
    
    // MARK: - String constants
    
    private let kTakePhotoKey: String = "takePhoto"
    
    private let kTakeVideoKey: String = "takeVideo"
