-
Notifications
You must be signed in to change notification settings - Fork 0
/
DetailViewController.swift
60 lines (46 loc) · 1.8 KB
/
DetailViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// DetailViewController.swift
// MovieViewer
//
// Created by Andrei Gurau on 1/18/16.
// Copyright © 2016 Andrei Gurau. All rights reserved.
//
import UIKit
class DetailViewController: UIViewController {
@IBOutlet weak var posterImageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var infoView: UIView!
@IBOutlet weak var overViewLabel: UILabel!
@IBOutlet weak var scrollView: UIScrollView!
var movie: NSDictionary!
override func viewDidLoad() {
super.viewDidLoad()
print(movie)
scrollView.contentSize = CGSize(width: scrollView.frame.size.width, height: infoView.frame.origin.y + infoView.frame.size.height)
// Do any additional setup after loading the view.
let title = movie["title"] as? String
titleLabel.text = title
let overview = movie["overview"] as? String
overViewLabel.text = overview
overViewLabel.sizeToFit()
if let posterPath = movie["poster_path"] as? String
{
let baseUrl = "http://image.tmdb.org/t/p/w500"
let imageUrl = NSURL(string: baseUrl + posterPath)
posterImageView.setImageWithURL(imageUrl!)
}
self.navigationItem.title = title
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}