Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func getFrame(size: CGSize, fitIn:CGFloat) -> CGSize {
- var ratio: CGFloat = 0.0
- var newH: CGFloat = 0.0
- var newW: CGFloat = 0.0
- if size.width > size.height {
- ratio = size.width / size.height
- } else {
- ratio = size.height / size.width
- }
- newH = fitIn / ratio
- newW = newH * ratio
- return CGSize(width: newW, height: newH)
- }
Advertisement
Add Comment
Please, Sign In to add comment