Skip to content

Commit

Permalink
Fix HeaderImageView Frame Size
Browse files Browse the repository at this point in the history
  • Loading branch information
t-nakano committed Feb 21, 2018
1 parent 5d3c1c7 commit 6b93bee
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions HeaderZoomTableView/HeaderZoomTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ public class HeaderZoomTableView: UITableView {
}
}

public override init(frame: CGRect, style: UITableViewStyle) {
super.init(frame: frame, style: style)
setUpCoverImage()
}

required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setUpCoverImage()
}

private func setUpCoverImage() {
var aspect: CGFloat = CGFloat(3.0 / 4.0)
switch imageAspectRatio {
Expand All @@ -59,10 +49,10 @@ public class HeaderZoomTableView: UITableView {
aspect = CGFloat(h / w)
}

let width = self.bounds.width
let width = UIScreen.main.bounds.width
let height = width * aspect

headerImageView.frame = CGRect(origin: .zero, size: CGSize(width: self.bounds.width, height: height))
headerImageView.frame = CGRect(origin: .zero, size: CGSize(width: width, height: height))
self.tableHeaderView = headerImageView
}
}
Expand Down

0 comments on commit 6b93bee

Please sign in to comment.