Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>UICollectionView is a bit similar to UITableView. To get the customization you want, you first need to define your custom cell class:</p> <pre><code>public class AnimalCell : UICollectionViewCell { UIImageView imageView; [Export ("initWithFrame:")] public AnimalCell (System.Drawing.RectangleF frame) : base (frame) { BackgroundView = new UIView{BackgroundColor = UIColor.Orange}; SelectedBackgroundView = new UIView{BackgroundColor = UIColor.Green}; ContentView.Layer.BorderColor = UIColor.LightGray.CGColor; ContentView.Layer.BorderWidth = 2.0f; ContentView.BackgroundColor = UIColor.White; ContentView.Transform = CGAffineTransform.MakeScale (0.8f, 0.8f); imageView = new UIImageView (UIImage.FromBundle ("placeholder.png")); imageView.Center = ContentView.Center; imageView.Transform = CGAffineTransform.MakeScale (0.7f, 0.7f); ContentView.AddSubview (imageView); } public UIImage Image { set { imageView.Image = value; } } } </code></pre> <p>Then you can reference this cell in your UICollectionViewDataSource class by overriding the GetCell method:</p> <pre><code>public override UICollectionViewCell GetCell (UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath) { var animalCell = (AnimalCell)collectionView.DequeueReusableCell (animalCellId, indexPath); var animal = animals [indexPath.Row]; animalCell.Image = animal.Image; return animalCell; } </code></pre> <p>For more info, you should checkout this tutorial on Xamarin's website that I pulled these examples from: <a href="http://docs.xamarin.com/guides/ios/user_interface/introduction_to_collection_views" rel="nofollow">http://docs.xamarin.com/guides/ios/user_interface/introduction_to_collection_views</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload