UIKit.UIView.Bounds Property
The usable frame of the view, specified using the view's own coordinate system.

Syntax

[ObjCRuntime.ThreadSafe]
[get: Foundation.Export("bounds")]
[set: Foundation.Export("setBounds:")]
public virtual CoreGraphics.CGRect Bounds { get; set; }

Value

Remarks

This property represents the usable frame of the view. Unlike the UIView.Frame, the UIView.Bounds do not use the container's coordinate space, but instead represent the size in the view's own coordinate space. By default the UIView.Bounds location is (0,0).

When you update this property, it will modify the UIView.Frame based on the value of the UIView.Center. You can also change the position of your view by updating the UIView.Center property.

When the Bound property is changed, the size of the view is affected relative to the UIView.Center property.

The UIView.Bounds property is relative to this UIKit.UIView's coordinate system. For instance, the following example shows a view (a UIKit.UIImageView, actually) that has been rotated 45 degrees. The value of flowerView.Bounds remains [{0,0},{100,100}]. In contrast, the UIView.Frame property is expressed in terms of the containing view's coordinate system. In this case, after the rotation has been applied, the value of flowerView.Frame becomes [{79.3,79.3}, {141.4, 141.4}].

C# Example

var flowerView = new UIImageView(new RectangleF(100, 100, 100, 100)) {
	Image = UIImage.FromFile("flower.png"),
	ContentMode = UIViewContentMode.Center,
	ClipsToBounds = true
};

flowerView.Transform = CGAffineTransform.MakeRotation((float) Math.PI / 4);
view.AddSubview(flowerView);            
              

This can be used from a background thread.

Requirements

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