UIKit.UIViewContentMode Enumeration
An enumeration indicating how the cached bitmap of a view must be rendered when the view's bounds change.

Syntax

[ObjCRuntime.Native]
public enum UIViewContentMode

Remarks

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}.

ValueBehavior
UIViewContentMode.BottomAligns the content to the bottom of the view.

UIViewContentMode.BottomLeftAligns the content to the bottom left of the view.

UIViewContentMode.BottomLeftAligns the content to the bottom left of the view.

UIViewContentMode.BottomLeftAligns the content to the bottom left of the view.

UIViewContentMode.BottomLeftAligns the content to the bottom left of the view.

UIViewContentMode.BottomLeftAligns the content to the bottom left of the view.

UIViewContentMode.BottomRightAligns the content to the bottom right of the view.

UIViewContentMode.CenterCenter the content in the view.

UIViewContentMode.LeftAligns the content to the left of the view.

UIViewContentMode.RedrawForces a redraw when the UIView.Frame of an object changes.
UIViewContentMode.RightAligns the content to the right of the view.

UIViewContentMode.ScaleAspectFillScales the contents to fill the new bounaries of the view, while preserving the aspect ratio. This means that the contents might be clipped.

UIViewContentMode.ScaleAspectFitScales 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.ScaleToFillScales the contents to fit the new bounds, this might distort the contents.

UIViewContentMode.TopAligns the content to the top of the view.

UIViewContentMode.TopLeftAligns the content to the top left of the view.

UIViewContentMode.TopRightAligns the content to the top right of the view.

Members

Member NameDescription
BottomAligns the content to the bottom of the view.
BottomLeftAligns the content to the bottom left of the view.
BottomRightAligns the content to the bottom right side of the view.
CenterCenters the contents in the view
LeftAligns the content to the left of the view.
RedrawThis forces a redraw when the UIView.Frame of an object changes.
RightAligns the content to the right of the view..
ScaleAspectFillScales the contents to fill the new bounaries of the view, while preserving the aspect ratio. This means that the contents might be clipped.
ScaleAspectFitScales the contents so that everything is visible, while preserving the aspect ration. Any areas that are not filled become transparent.
ScaleToFillScales the contents to fit the new bounds, this might distort the contents.
TopAligns the content to the top of the view.
TopLeftAligns the content to the top left of the view.
TopRightAligns the content to the top right of the view.

Requirements

Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0