Class LayoutContainer
Inheritance
Namespace: FM.LiveSwitch.Cocoa
Assembly: FM.LiveSwitch.Cocoa.dll
Syntax
public class LayoutContainer : UIView
Constructors
LayoutContainer(CGRect)
Initializes a new instance of the LayoutContainer class.
Declaration
public LayoutContainer(CGRect rect)
Parameters
Type | Name | Description |
---|---|---|
CGRect | rect | The rect. |
Properties
Frame
Coordinates of the view relative to its container.
Declaration
public override CGRect Frame { get; set; }
Property Value
Type | Description |
---|---|
CGRect | The value of this property is in points, not pixels. |
Remarks
The UIKit.UIView.Frame property is expressed in terms of the UIKit.UIView.Superview's coordinate system. (The UIKit.UIView.Bounds property is expressed in terms of this
UIKit.UIView's coordinate system.)
The following example shows just one way the UIKit.UIView.Frame's coordinate system and values can vary from that of the UIKit.UIView's UIKit.UIView.Bounds. In this case, a UIKit.UIImageView is placed with an initial UIKit.UIView.Frame originating at {100,100} and of size {100,100}. Once rotated, both the origin and size of the UIKit.UIView.Frame bounding box shift: the origin to accomodate the rotation and the sizes in order to contain the diagonal of the {100,100} box. The UIKit.UIView.Bounds of the flowerView
remains [{0,0},{100,100}].
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);
When changes are done to this property, the UIKit.UIView.Center is updated with the new location and the UIKit.UIView.Bounds is updated with the new dimensions and a re-layout of the subviews is performed.
Changing this property will not trigger a call to UIKit.UIView.Draw(System.Drawing.RectangleF) unless you set the UIKit.UIView.ContentMode property to UIKit.UIViewContentMode.Redraw.
At least on iOS 6 and later, changing this property causes the a re-layout of the subviews, even if the dimensions are the same. This can cause performance problems as some views (like UITableView) can perform some very expensive computations when they are laid out.
If your UIKit.UIView.ContentMode property is set to UIKit.UIViewContentMode.Redraw, you can avoid a redraw of your view if you update the UIKit.UIView.Center property instead of updating the Frame as that one will merely move the view without triggering a call to UIKit.UIView.LayoutSubviews().
This property participates in the implicit animation protocol, changing it outside of a transaction will trigger an implicit animation for its values.
If you change the UIKit.UIView.Transform property to a matrix that does not represent the identity matrix, changing this property can have unintended consequences. In those cases, you should instead update UIKit.UIView.Center and UIKit.UIView.Bounds directly.