private void SetupTrapModifyScoresViewController() { var layout = new UICollectionViewFlowLayout(); layout.ItemSize = new CGSize(this.View.Frame.Width - 20, 40); layout.ScrollDirection = UICollectionViewScrollDirection.Vertical; layout.SectionInset = new UIEdgeInsets(0f, 0f, 10f, 0f); this.CollectionView = new UICollectionView(new CGRect(0f, 40f, this.View.Frame.Width, this.View.Frame.Height - 40), layout); this.CollectionView.Delegate = new TrapShooterLayoutDelegate(); this.CollectionView.BackgroundColor = ColorConstants.BackgroundColor; this.CollectionView.ContentInset = new UIEdgeInsets(20, 10, 0, 10); CollectionView.RegisterClassForCell(typeof(TrapModifyScoresViewCell), TrapModifyScoresViewCell.Key); CollectionView.RegisterClassForCell(typeof(LabelViewCell), LabelViewCell.Key); this.CollectionView.DataSource = new TrapModifyScoresDataSource(this.TrapShooters, this.Delegate); UIView view = new UIView(new CGRect(0f, 0f, this.View.Frame.Width, 40f)); view.BackgroundColor = ColorConstants.PrimaryColor; UIButton button = new UIButton(new CGRect(0f, 0f, 40f, 40f)); button.SetTitle("X", UIControlState.Normal); button.TitleLabel.Font = UIFont.PreferredTitle1; button.TitleLabel.LineBreakMode = UILineBreakMode.Clip; button.TitleLabel.Lines = 1; button.TitleLabel.AdjustsFontSizeToFitWidth = true; button.SetTitleColor(ColorConstants.BackgroundColor, UIControlState.Normal); button.TouchUpInside += (o, e) => { this.DismissModalViewController(true); }; view.AddSubview(button); this.View.AddSubview(view); this.View.AddSubview(this.CollectionView); }
public TrapModifyScoresViewController(List <TrapShooter> trapShooters, IScoreModifiedDelegate modifiedDelegate) : base() { this.TrapShooters = trapShooters; this.Delegate = modifiedDelegate; }
public TrapModifyScoresDataSource(List <TrapShooter> trapShooters, IScoreModifiedDelegate modifiedDelegate) { this.TotalShooters = trapShooters.Count; this.TrapShooters = trapShooters; this.Delegate = modifiedDelegate; }