In this article we will talk about the ways in which elements can be worked with within a view, the value of this property by default comes as .scaleToFill.
We use this property when we want to implement resizable controls. For example, instead of having to redraw every time, we use content mode so that the element adapts as necessary.
.scaleToFill
- Fills the entire view, so it can lose proportion
.scaleAspectFit
- Adjusts the content to fit the view while maintaining the aspect ratio, any remaining area is transparent
.scaleAspectFill
- It fills the view while maintaining the proportion, but the element may go beyond the limits of the view.
.center
- Centers the content and maintains the same proportions
.top
- Aligns and centers the content at the top of the view
.bottom
- Aligns and centers the content at the bottom of the view
.left
- Aligns and centers the content on the left side of the view
.right
- Aligns and centers the content on the right side of the view
.topLeft
- Aligns content to the left at the top of the view
.topRight
- Aligns content to the right at the top of the view
.bottomLeft
- Aligns content to the left at the bottom of the view
.bottomRight
- Aligns content to the right at the bottom of the view
.redraw
- Indicates that the view needs to be redrawn every time the size is changed, we use this when the content of the view depends on the view
Thanks for read this article!
Top comments (0)