-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Silence iPad constraint errors
- Loading branch information
Showing
29 changed files
with
395 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Demo/UIOnboarding Demo/UIOnboarding Demo/Onboarding/Views/UIIntrinsicLabel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// UIIntrinsicLabel.swift | ||
// UIOnboarding Demo | ||
// | ||
// Created by Lukman Aščić on 07.08.23. | ||
// | ||
|
||
import UIKit | ||
|
||
class UIIntrinsicLabel: UILabel { | ||
private let gutter: CGFloat = 4 | ||
|
||
override func draw(_ rect: CGRect) { | ||
super.drawText(in: rect.insetBy(dx: gutter, dy: 0)) | ||
} | ||
|
||
override var alignmentRectInsets: UIEdgeInsets { | ||
.init(top: 0, left: gutter, bottom: 0, right: gutter) | ||
} | ||
|
||
override var intrinsicContentSize: CGSize { | ||
var size = super.intrinsicContentSize | ||
size.width += gutter * 2 | ||
return size | ||
} | ||
|
||
override func sizeThatFits(_ size: CGSize) -> CGSize { | ||
let fixedSize: CGSize = .init(width: size.width - 2 * gutter, height: size.height) | ||
let sizeWithoutGutter: CGSize = super.sizeThatFits(fixedSize) | ||
return .init(width: sizeWithoutGutter.width + 2 * gutter, height: sizeWithoutGutter.height) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.