UIKit.UIView.Transform Property
The transform of the UIKit.UIView, relative to the center of its bounds.

Syntax

[get: Foundation.Export("transform")]
[set: Foundation.Export("setTransform:")]
public virtual CoreGraphics.CGAffineTransform Transform { get; set; }

Value

The default value is the identity transform.

Remarks

This property can be used to manipulate the CoreGraphics.CGAffineTransform that is applied to the UIKit.UIView prior to rendering. The UIView.Transform is applied to the center of the UIKit.UIView's UIView.Bounds.

The transform is applied prior to Auto Layout constraints being applied. For instance, the following code shows constraints that, with default transforms, lay out three equally sized subviews with 30-pixel vertical spacing. A scaling transform is applied to the green view and a rotational transform to the yellow. The following image shows the result: the transforms are applied and then the Auto Layout constraints are resolved. The result is that the views are resized such that their width and height match the constraints. This effectively overrides the scaling transform on the green view while rotating and scaling the yellow view such that it's alignment rectangle satisfies the constraints.

C# Example

mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[blue]-|", 0, new NSDictionary(), viewsDictionary));
mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[blue]-(==30)-[green(==blue)]-(==30)-[yellow(==blue)]-|", 0, new NSDictionary(), viewsDictionary));
mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat("|-[green(==blue)]-|", 0, new NSDictionary(), viewsDictionary));
mainView.AddConstraints(NSLayoutConstraint.FromVisualFormat("|-[yellow(==blue)]-|", 0, new NSDictionary(), viewsDictionary));

greenView.Transform = CGAffineTransform.MakeScale(2F, 2F);
yellowView.Transform = CGAffineTransform.MakeRotation((float)(Math.PI / 10));		

Requirements

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