The contents of the UIKit.UIView are cached in a bitmap, the values in this enumeration determine what happens to a view when the bounds of that view change. With these you can control whether the bitmap is stretched or whether the view is redrawn.
The following table shows the behavior as it works placing this {638, 475} image in a UIKit.UIImageView of size {280, 100}.
Value | Behavior | |
---|---|---|
UIViewContentMode.Bottom | Aligns the content to the bottom of the view. | |
UIViewContentMode.BottomLeft | Aligns the content to the bottom left of the view. | |
UIViewContentMode.BottomLeft | Aligns the content to the bottom left of the view. | |
UIViewContentMode.BottomLeft | Aligns the content to the bottom left of the view. | |
UIViewContentMode.BottomLeft | Aligns the content to the bottom left of the view. | |
UIViewContentMode.BottomLeft | Aligns the content to the bottom left of the view. | |
UIViewContentMode.BottomRight | Aligns the content to the bottom right of the view. | |
UIViewContentMode.Center | Center the content in the view. | |
UIViewContentMode.Left | Aligns the content to the left of the view. | |
UIViewContentMode.Redraw | Forces a redraw when the UIView.Frame of an object changes. | |
UIViewContentMode.Right | Aligns the content to the right of the view. | |
UIViewContentMode.ScaleAspectFill | Scales the contents to fill the new bounaries of the view, while preserving the aspect ratio. This means that the contents might be clipped. | |
UIViewContentMode.ScaleAspectFit | Scales the contents so that everything is visible, while preserving the aspect ratio. Any areas that are not filled become transparent. (In the image, the UIImage.BackgroundColor was set to black to emphasize the scaling behavior.) | |
UIViewContentMode.ScaleToFill | Scales the contents to fit the new bounds, this might distort the contents. | |
UIViewContentMode.Top | Aligns the content to the top of the view. | |
UIViewContentMode.TopLeft | Aligns the content to the top left of the view. | |
UIViewContentMode.TopRight | Aligns the content to the top right of the view. |
Member Name | Description |
---|---|
Bottom | Aligns the content to the bottom of the view. |
BottomLeft | Aligns the content to the bottom left of the view. |
BottomRight | Aligns the content to the bottom right side of the view. |
Center | Centers the contents in the view |
Left | Aligns the content to the left of the view. |
Redraw | This forces a redraw when the UIView.Frame of an object changes. |
Right | Aligns the content to the right of the view.. |
ScaleAspectFill | Scales the contents to fill the new bounaries of the view, while preserving the aspect ratio. This means that the contents might be clipped. |
ScaleAspectFit | Scales the contents so that everything is visible, while preserving the aspect ration. Any areas that are not filled become transparent. |
ScaleToFill | Scales the contents to fit the new bounds, this might distort the contents. |
Top | Aligns the content to the top of the view. |
TopLeft | Aligns the content to the top left of the view. |
TopRight | Aligns the content to the top right of the view. |