             }
         }
     }
-    
-    
-    
-    
+
     func addCaption() {
-        self.caption = UILabel(frame: CGRectMake(0, 0, self.bounds.width, 50))
+        self.caption = UILabel(frame: CGRectMake(0, self.bounds.height-50, self.bounds.width, 50))
         caption.textAlignment = NSTextAlignment.Center
         caption.numberOfLines = 0
         caption.lineBreakMode = NSLineBreakMode.ByWordWrapping

    
    var gifUrl: NSString = "" {
        didSet {
            NSLog("downloading %@", gifUrl)
            weak var myAnimatedView : FLAnimatedImageView? = self.animatedView
            downloadData(NSURL(string: gifUrl)) {(data, error) in
                if error != nil {
                    NSLog("download error: %@", error!)
                } else {
                    if let myConcreteAnimatedView = myAnimatedView {
                        myConcreteAnimatedView.animatedImage = FLAnimatedImage(animatedGIFData: data)
                    }
                }
            }
        }
    }
    
    func downloadData(url: NSURL!, callback: (NSData, String?) -> Void) {
        var session = NSURLSession.sharedSession()
        task = session.dataTaskWithURL(url) {(data, response, error) in
            if error != nil {
                callback(NSData(), error.localizedDescription)
            } else {
                callback(data, nil)
            }
        }
        task!.resume()
    }
}

import UIKit
import MediaPlayer

class GifView: UIView, NSURLSessionDataDelegate, NSURLSessionTaskDelegate{
    var animatedView:FLAnimatedImageView!
    var caption:UILabel!
    var mpc:MPMoviePlayerController!
    var imageId:NSString? // Not sure if this belongs here, but helps us know which Image is associated with this view
    var task:NSURLSessionDataTask?
    var imageBytes:NSMutableData?
    var totalBytesLength:Float64?
  
    var passLabel:UILabel!
    var faveLabel:UILabel!

