iOS Guides | Samples

MonoTouch.UIKit.UICollectionViewLayoutAttributes Class

Provides layout attributes for UICollectionViewLayouts.

See Also: UICollectionViewLayoutAttributes

Syntax

[MonoTouch.Foundation.Register("UICollectionViewLayoutAttributes", true)]
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 6, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
public class UICollectionViewLayoutAttributes : NSObject, INSCopying, IUIDynamicItem, IDisposable

Remarks

Application developers who override this class in order to provide additional layout parameters should also override UICollectionReusableView.ApplyLayoutAttributes to apply them.

In order to get a layout attributes object for a subclass of this class, you must call UICollectionViewLayoutAttributes.CreateForCell`1 and specify the type of the subclass, like this:

C# Example

// A custom UICollectionViewLayoutAttributes class with one extra property
public class CustomCollectionViewLayoutAttributes : UICollectionViewLayoutAttributes {
  public int SomeProperty { get; set; }
  public override NSObject Copy ()
  {
    // It is required to override Copy, iOS will call this method to clone your object.
    var copy = (CustomCollectionViewLayoutAttributes) base.Copy ();
    copy.SomeProperty = SomeProperty;
    return copy;
  }
}
public class CircleLayout : UICollectionViewLayout {
  public override UICollectionViewLayoutAttributes LayoutAttributesForItem (NSIndexPath path)
  {
    var attributes = UICollectionViewLayoutAttributes.CreateForCell<CustomCollectionViewLayoutAttributes> (path);
    attributes.SomeProperty = 1;
    return attributes;
  }
 }

UICollectionViewLayoutAttributes implements IUIDynamicItem and thus can be used with UI Dynamics.

Related content

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

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

See Also: NSObject

Public Constructors

Default constructor, initializes a new instance of this class.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

AlphaSingle. The transparency to be applied.
BoundsRectangleF. The RectangleF describing the bounds of the item.
CenterPointF. The center of the item.
[read-only]
override
ClassHandleIntPtr. The handle for this class.
[read-only]
CollisionBoundingPathUIBezierPath. Gets the UIBezierPath to be used for collision detection.
[read-only]
CollisionBoundsTypeUIDynamicItemCollisionBoundsType. Gets the UIDynamicItemCollisionBoundsType describing the type of bounds used for collision detected.
FrameRectangleF. The RectangleF frame for the UICollectionView
HiddenBoolean. Whether the UICollectionView is hidden or not.
IndexPathNSIndexPath. The index path of the item in the UICollectionView.
[read-only]
RepresentedElementCategoryUICollectionElementCategory. Used to identify the specific purpose of a supplementary or decoration view. Read-only.
[read-only]
RepresentedElementKindString. Used to identify the specific purpose of a supplementary or decoration view. Read-only.
SizeSizeF. The SizeF of the item.
TransformCGAffineTransform. The affine transform of the item.
Transform3DCATransform3D. The 3D transform of the item. (If not null, Frame will be set to null.)
ZIndexInt32. The Z-Index of the item. (Higher values appear in front of lower values.)

Public Methods

Copy(NSZone) : NSObject
Performs a copy of the underlying Objective-C object.
static
CreateForCell(NSIndexPath) : UICollectionViewLayoutAttributes
Creates a UICollectionViewLayoutAttributes for the cell at the specified index.|Creates a UICollectionViewLayon
static
CreateForCell<T>(NSIndexPath) : T
Creates a layout attributes object of the specified type for the cell at the specified index path.
static
CreateForDecorationView(NSString, NSIndexPath) : UICollectionViewLayoutAttributes
Creates a layout attributes object representing the decoration view.
static
CreateForDecorationView<T>(NSString, NSIndexPath) : T
Creates a layout attributes object of a specific type representing the decoration view.
static
CreateForSupplementaryView(NSString, NSIndexPath) : UICollectionViewLayoutAttributes
Creates a layout attributes object representing the supplementary view.
static
CreateForSupplementaryView(UICollectionElementKindSection, NSIndexPath) : UICollectionViewLayoutAttributes
Creates a layout attributes object representing the supplementary view.
static
CreateForSupplementaryView<T>(NSString, NSIndexPath) : T
Creates a layout attributes object of a specific type representing the supplementary view.
static
CreateForSupplementaryView<T>(UICollectionElementKindSection, NSIndexPath) : T
Creates a layout attributes object representing the supplementary view.