-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to setup a newly create frameLayout? #5
Comments
Imagine the FrameLayout you just created as a picture frame containing various photos. If you move the picture frame or change its size, the photos inside will also move and their contents will adjust accordingly. Therefore, you just need to set the size of the picture frame to match the size you want to display. In this case, just set like this: // assume that frameLayout was placed inside another UIView
override open func layoutSubviews() {
super.layoutSubviews()
frameLayout.frame = bounds
}
// or if frameLayout was placed inside an UIViewController
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
frameLayout.frame = view.bounds
} |
@kennic what about to add functionality which allow to avoid that? I also know that sometimes |
Actually, you can use an autoresizing mask for frameLayout to fit its frame to its superview. Please try that in your code. If it's not working, feel free to share your code here for further assistance. |
When you create frameLayout its content is aligned. frameLayout is added to UIView like another common UIView.
But how to set frameLayout position and size in outer container? Should I use autolayout or autoresizing mask?
The text was updated successfully, but these errors were encountered: