Skip to content

Instantly share code, notes, and snippets.

@khurram18
Last active March 31, 2020 14:56
Show Gist options
  • Save khurram18/4097f0014a18d054d08ce7acad571109 to your computer and use it in GitHub Desktop.
Save khurram18/4097f0014a18d054d08ce7acad571109 to your computer and use it in GitHub Desktop.
private func updateLabelPosition(_ cell: TableViewCell) {
let point = view.convert(cell.contributerNameLabel.frame.origin, from: cell.contentView) // 1
let ratio = point.y / viewHeight // 2
let updatedConstraint = (ratio * constraintRange) + minimumConstraint // 3
cell.nameLabelTopConstraint.constant = updatedConstraint // 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment