本文整理汇总了C#中UICollectionView类的典型用法代码示例。如果您正苦于以下问题:C# UICollectionView类的具体用法?C# UICollectionView怎么用?C# UICollectionView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UICollectionView类属于命名空间,在下文中一共展示了UICollectionView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemSelected
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath)
{
if (lastSelectedCell != null) {
lastSelectedCell.BackgroundColor = UIColor.Clear;
}
var cell = collectionView.CellForItem (indexPath);
cell.BackgroundColor = UIColor.Cyan;
lastSelectedCell = cell;
if (cell is FriendsPuzzleListCellViewController) {
// var friendsCell = cell as FriendsPuzzleListCellViewController;
// var puzzle = puzzlesWitHFriends [indexPath.Item - 1];
} else if (cell is FriendsPuzzleListNewCellViewController) {
var vc = this.Storyboard.InstantiateViewController("MenuCreateViewController") as MenuCreateViewController;
vc.IsFriendMatch = true;
NavigationController.PushViewController(
vc,
true
);
}
}
示例2: GetItemsCount
public override int GetItemsCount(UICollectionView collectionView, int section)
{
if (section == 0)
return Team1.Count;
else
return Team2.Count;
}
示例3: GetCell
public override UICollectionViewCell GetCell(UICollectionView collectionView, Foundation.NSIndexPath indexPath)
{
var cell = (ListingImageCell)collectionView.DequeueReusableCell(CellID, indexPath);
cell.Image = urls[indexPath.Row];
return cell;
}
示例4: GetCell
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
var cell = collectionView.DequeueReusableCell(ToolCell.Key, indexPath) as ToolCell;
cell.Text = AvailableTools[indexPath.Item].Name;
cell.SetBorder();
return cell;
}
示例5: GetCell
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
DBError err;
PhotoCell cell = (PhotoCell)collectionView.DequeueReusableCell(PhotoCell.Key, indexPath);
DBPath path = Photos [Photos.Length - indexPath.Row - 1].Path;
DBFile file = DBFilesystem.SharedFilesystem.OpenFile (path, out err);
UIImage image = null;
// This means the file doesn't exist, or it is open with asynchronous operation.
if (file == null) {
cell.Content = null;
return cell;
}
if (file.Status.Cached) {
image = new UIImage (file.ReadData (out err));
file.Close ();
} else {
file.AddObserver (this, () => {
DBFileStatus newStatus = file.NewerStatus;
if ((newStatus == null && file.Status.Cached) ||
(newStatus != null && newStatus.Cached)) {
image = new UIImage (file.ReadData (out err));
cell.Content = image;
file.RemoveObserver(this);
file.Close ();
}
});
}
cell.Content = image;
return cell;
}
示例6: MoveItem
public override void MoveItem (UICollectionView collectionView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath)
{
// Reorder our list of items
var item = Numbers [(int)sourceIndexPath.Item];
Numbers.RemoveAt ((int)sourceIndexPath.Item);
Numbers.Insert ((int)destinationIndexPath.Item, item);
}
示例7: GetItemsCount
public override nint GetItemsCount(UICollectionView collectionView, nint section)
{
if ((dateList == null) || (dateList.Count == 0))
return (nint)0;
else
return (nint)dateList.Count;
}
示例8: GetSizeForItem
public override CoreGraphics.CGSize GetSizeForItem (UICollectionView collectionView, UICollectionViewLayout layout, Foundation.NSIndexPath indexPath)
{
if (Master.MaxHeight != 0) {
return new CoreGraphics.CGSize ((Master.View.Frame.Size.Width - 10) / 3, Master.MaxHeight);
}
return new CoreGraphics.CGSize ((Master.View.Frame.Size.Width - padding - 10) / 3, (Master.View.Frame.Size.Width - padding - 10) / 3 + differential);
}
示例9: GetViewForSupplementaryElement
public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
{
if (elementKind == (NSString)"UICollectionElementKindSectionHeader") {
PictureHeaderVIew header = (PictureHeaderVIew)collectionView.DequeueReusableSupplementaryView
(UICollectionElementKindSection.Header, (NSString)"header", indexPath);
header.title.Frame = new RectangleF (20, 15, 230, 300);
header.title.Text = Items.Title;
header.title.Lines = 0;
header.title.SizeToFit ();
header.photo.Image = UIImage.FromFile ("./Assets/photo.png");
header.picturesCount.Text = Items.Images.Count.ToString();
return header;
}
else {
StartReadingView footer = (StartReadingView)collectionView.DequeueReusableSupplementaryView
(UICollectionElementKindSection.Footer, (NSString)"collectionfooter", indexPath);
footer.StartReading.SetBackgroundImage (UIImage.FromFile ("./Assets/buttonlong.png"), UIControlState.Normal);
footer.StartReading.TouchUpInside += (object sender, EventArgs e) => {
UIStoryboard board = UIStoryboard.FromName ("MainStoryboard", null);
var prefs = (PreferencesSubController)board.InstantiateViewController ("preferencessub");
this.NavigationController.PushViewController(prefs, true);
};
return footer;
}
}
示例10: GetCell
public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
{
var cell = (ProductCell)collectionView.DequeueReusableCell (reuseIdentifier, indexPath);
ConfigureCell (cell, Products [indexPath.Row]);
return cell;
}
示例11: NumberOfSections
public override nint NumberOfSections (UICollectionView collectionView)
{
if (Master.CollectionItems == null || Master.CollectionItems.Count == 0) {
return 0;
}
return 1;
}
示例12: GetItemsCount
public override int GetItemsCount (UICollectionView collectionView, int section)
{
if (ItemsSource == null)
return 0;
return ItemsSource.Count();
}
示例13: ItemSelected
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath)
{
var photoController = new PhotoViewController {
Asset = (PHAsset)fetchResults[indexPath.Item]
};
NavigationController.PushViewController (photoController, true);
}
示例14: GetCell
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
var cell = (PictureBigCollectionCell)collectionView.DequeueReusableCell (PictureBigCollectionCell.CellId, indexPath);
cell.resetScale ();
AppDelegate.MakeImageFromURL (cell.Image, Items.Images [indexPath.Row]);
return cell;
}
示例15: GetViewForSupplementaryElement
// TODO: Step 2c: uncomment to get a header instance to use for the Supplementary View
public override UICollectionReusableView GetViewForSupplementaryElement (UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
{
// get a Header instance to use for the supplementary view
var headerView = (Header)collectionView.DequeueReusableSupplementaryView (elementKind, headerId, indexPath);
headerView.Text = "Evolve Speakers";
return headerView;
}