Skip to content

Commit

Permalink
Merge pull request #536 from SourcePointUSA/DIA-2935-less-space-betwe…
Browse files Browse the repository at this point in the history
…en-header-and-purposes

DIA-2935 Dynamic `frame` by `constrains`
  • Loading branch information
andresilveirah authored Jan 2, 2024
2 parents 4d1b2be + fe603d6 commit b908b9b
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class SPGDPRManagePreferenceViewController: SPNativeScreenViewController {
setHeader()
loadTextView(forComponentId: "CategoriesHeader", textView: descriptionTextView, bounces: false)
descriptionTextView.flashScrollIndicators()
dynamicFrameForDescription()
loadButton(forComponentId: "AcceptAllButton", button: acceptButton)
loadButton(forComponentId: "SaveButton", button: saveAndExit)
loadSliderButton(forComponentId: "CategoriesSlider", slider: categorySlider)
Expand Down Expand Up @@ -145,6 +146,17 @@ class SPGDPRManagePreferenceViewController: SPNativeScreenViewController {
header.spTitleText = viewData.byId("Header") as? SPNativeText
header.onBackButtonTapped = { [weak self] in self?.dismiss(animated: true) }
}

func dynamicFrameForDescription() {
let width = descriptionTextView.frame.size.width
let height = descriptionTextView.frame.height
descriptionTextView.translatesAutoresizingMaskIntoConstraints = true
descriptionTextView.sizeToFit()
descriptionTextView.frame.size.width = width
if descriptionTextView.frame.size.height > height {
descriptionTextView.frame.size.height = height
}
}
}

// MARK: UITableViewDataSource
Expand Down

0 comments on commit b908b9b

Please sign in to comment.