iOS Guides | Samples

MonoTouch.UIKit.UIViewContentMode Enumeration

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

Syntax

[MonoTouch.ObjCRuntime.Native]
[MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.WatchOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
public enum UIViewContentMode

Remarks

The contents of the 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 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: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

The members of MonoTouch.UIKit.UIViewContentMode are listed below.

See Also: Enum

Public Fields

BottomUIViewContentMode. Aligns the content to the bottom of the view.
BottomLeftUIViewContentMode. Aligns the content to the bottom left of the view.
BottomRightUIViewContentMode. Aligns the content to the bottom right side of the view.
CenterUIViewContentMode. Centers the contents in the view
LeftUIViewContentMode. Aligns the content to the left of the view.
RedrawUIViewContentMode. This forces a redraw when the UIView.Frame of an object changes.
RightUIViewContentMode. Aligns the content to the right of the view..
ScaleAspectFillUIViewContentMode. Scales the contents to fill the new bounaries of the view, while preserving the aspect ratio. This means that the contents might be clipped.
ScaleAspectFitUIViewContentMode. Scales the contents so that everything is visible, while preserving the aspect ration. Any areas that are not filled become transparent.
ScaleToFillUIViewContentMode. Scales the contents to fit the new bounds, this might distort the contents.
TopUIViewContentMode. Aligns the content to the top of the view.
TopLeftUIViewContentMode. Aligns the content to the top left of the view.
TopRightUIViewContentMode. Aligns the content to the top right of the view.