Advertisement
srk72

Dynamic Laleb Height

Dec 19th, 2022
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.35 KB | None | 0 0
  1.     private func labelMaxHeight(_ label: UILabel) -> CGFloat {
  2.         let maxFrameHeight: CGFloat = 80
  3.  
  4.         label.sizeToFit()
  5.         let newFrameHeight = label.frame.size.height
  6.         let safeNewHeight = min(newFrameHeight, maxFrameHeight)
  7.  
  8.         return safeNewHeight
  9.     }
  10.  
  11. Usage :
  12.  
  13. addressHeight.constant = labelMaxHeight(addressValue)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement