Skip to content

Commit

Permalink
Fix bug when episode title was too long and was placed on top of the …
Browse files Browse the repository at this point in the history
…preview

Clips to bounds FTW
  • Loading branch information
pietrocaselani committed Jan 6, 2019
1 parent ec39442 commit c599336
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions CouchTrackerApp/Show/Episode/ShowEpisodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ShowEpisodeView: View {
imageView.contentMode = UIView.ContentMode.scaleAspectFill
imageView.isUserInteractionEnabled = true
imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTapOnPreview)))
imageView.clipsToBounds = true
return imageView
}()

Expand Down
41 changes: 29 additions & 12 deletions CouchTrackerPlayground.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import UIKit
import PlaygroundSupport

//import CouchTrackerApp
import CouchTrackerApp
import CouchTrackerCore
import TraktSwift
import TMDBSwift
Expand All @@ -12,17 +12,34 @@ import Kingfisher
import Cartography
import RxSwift

enum MyCoolState {
case empty
case done
case error(message: String)
}
final class ViewControllerDemo: UIViewController {
private var showView: ShowEpisodeView {
return self.view as! ShowEpisodeView
}

override func loadView() {
view = ShowEpisodeView()
}

override func viewDidLoad() {
super.viewDidLoad()

bug1()
}

//let subject = BehaviorSubject<MyCoolState>(value: .empty)
//
//func changeSubject() {
// subject.onNext(.error(message: "Eita!"))
//}
private func bug1() {
let posterLink = "https://image.tmdb.org/t/p/w780/pnUh2RawzYaSU8IjG61MT0AMRyf.jpg"
let previewLink = "https://image.tmdb.org/t/p/w500/jFtZF4cdm3yVaL5nNpEFq2hacGl.jpg"

showView.posterImageView.kf.setImage(with: posterLink.toURL)
showView.previewImageView.kf.setImage(with: previewLink.toURL)

showView.titleLabel.text = "It Was the Worst Day of My Life"
showView.overviewLabel.text = "After Annalise chooses Gabriel as her second chair, the unexpected duo puts all of their efforts into Nate Sr.’s murder re-trial as they try to convince a jury to grant an insanity plea. Meanwhile, Bonnie struggles to rebound after a dark part of her past resurfaces."

}
}

let vc = ColorsViewController()
//let vc = ColorsViewController()
let vc = ViewControllerDemo()
PlaygroundPage.current.liveView = vc
6 changes: 6 additions & 0 deletions CouchTrackerPlayground.playground/timeline.xctimeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Timeline
version = "3.0">
<TimelineItems>
</TimelineItems>
</Timeline>

0 comments on commit c599336

Please sign in to comment.