Beispiel #1
0
        public void DidSelectCell(PestoCardCollectionViewCell cell, Action completion)
        {
            Console.Write("Ooops! Sorry:)");
            zoomableView.Frame = new CGRect(cell.Frame.X, cell.Frame.Y - collectionViewController.scrollOffsetY,
                                            cell.Frame.Size.Width, cell.Frame.Size.Height - 50f);

            zoomableCardView.Frame = new CGRect(cell.Frame.X, cell.Frame.Y - collectionViewController.scrollOffsetY,
                                                cell.Frame.Size.Width, cell.Frame.Size.Height);

            DispatchQueue.MainQueue.DispatchAsync(() => {
                zoomableView.Image = cell.image;
                UIView.AnimateNotify(PestoDetail.AnimationDuration,
                                     0,
                                     UIViewAnimationOptions.CurveEaseOut,
                                     () =>
                {
                    var quantumEaseInOut = MDC_CAMediaTimingFunction.Mdc_functionWithType(MDCAnimationTimingFunction.EaseInOut);
                    CATransaction.AnimationTimingFunction = quantumEaseInOut;
                    var zoomFrame          = new CGRect(0, 0, View.Bounds.Size.Width, 320f);
                    zoomableView.Frame     = zoomFrame;
                    zoomableCardView.Frame = View.Bounds;
                },
                                     new UICompletionHandler((bool finished) => {
                    var detailVC             = new PestoDetailViewController();
                    detailVC.imageView.Image = cell.image;
                    detailVC.Title           = cell.title;
                    detailVC.descText        = cell.descText;
                    detailVC.iconImageName   = cell.iconImageName;

                    PresentViewController(detailVC, false, () => {
                        this.zoomableView.Frame     = CGRect.Empty;
                        this.zoomableCardView.Frame = CGRect.Empty;
                        completion();
                    });
                }));
            });
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (View.Frame.Size.Height > View.Frame.Size.Width)
            {
                fhvc.HeaderView.MinimumHeight = PestoDetail.FlexibleHeaderMinHeight;
            }
            else
            {
                fhvc.HeaderView.MinimumHeight = PestoDetail.FlexibleHeaderLandscapeHeight;
                fhvc.HeaderView.MaximumHeight = PestoDetail.FlexibleHeaderLandscapeHeight;
            }

            scrollView = new UIScrollView(View.Bounds);
            scrollView.BackgroundColor  = UIColor.White;
            scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth |
                                          UIViewAutoresizing.FlexibleHeight;

            View.AddSubview(scrollView);

            scrollView.Delegate = this;
            fhvc.HeaderView.TrackingScrollView = scrollView;
            fhvc.HeaderView.ClipsToBounds      = true;

            fhvc.View.Frame = View.Bounds;
            View.AddSubview(fhvc.View);

            fhvc.DidMoveToParentViewController(this);


            var bottomFrame = new CGRect(0, 0, View.Bounds.Size.Width,
                                         PestoDetail.RecipeCardHeight);

            bottomView = new PestoRecipeCardView(bottomFrame);

            bottomView.DescText         = this.descText;
            bottomView.Title            = this.Title;
            bottomView.IconImageName    = this.iconImageName;
            bottomView.Alpha            = 0;
            bottomView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth |
                                          UIViewAutoresizing.FlexibleHeight;
            scrollView.AddSubview(bottomView);

            DispatchQueue.MainQueue.DispatchAsync(() => {
                UIView.AnimateNotify(PestoDetail.AnimationDuration,
                                     PestoDetail.AnimationDelay,
                                     UIViewAnimationOptions.CurveEaseOut,
                                     () =>
                {
                    var quantumEaseInOut = MDC_CAMediaTimingFunction.Mdc_functionWithType(MDCAnimationTimingFunction.EaseInOut);
                    CATransaction.AnimationTimingFunction = quantumEaseInOut;
                    this.bottomView.Alpha = 1f;
                },
                                     new UICompletionHandler((bool finished) => {}));
            });

            appBar.AddSubviewsToParent();

            // Only display title in the bottom view with no title in the app bar.
            bottomView.Title           = Title;
            appBar.NavigationBar.Title = "";
        }