UIKit.UICollectionViewLayoutAttributes Class
Provides layout attributes for UIKit.UICollectionViewLayouts.

See Also: UICollectionViewLayoutAttributes Members


[Foundation.Register("UICollectionViewLayoutAttributes", true)]
public class UICollectionViewLayoutAttributes : Foundation.NSObject, Foundation.INSCopying, IUIDynamicItem, IDisposable


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;

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

Related content


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