Exemplo n.º 1
0
        private void ShowPowerPopup()
        {
            if (isPowerOpen || Username != AppSettings.User.Login)
            {
                return;
            }

            UIView.Animate(0.3f, 0f, UIViewAnimationOptions.CurveEaseOut, () =>
            {
                isPowerOpen      = true;
                powerPopup.Frame = new CGRect(new CGPoint(powerPopup.Frame.X, 0), powerPopup.Frame.Size);
            }, () =>
            {
                UIView.Animate(0.2f, 2f, UIViewAnimationOptions.CurveEaseIn, () =>
                {
                    powerPopup.Frame = new CGRect(new CGPoint(powerPopup.Frame.X, -NavigationController.NavigationBar.Frame.Bottom), powerPopup.Frame.Size);
                }, () =>
                {
                    isPowerOpen = false;
                });
            });
        }
Exemplo n.º 2
0
        private void Close(bool animated, nfloat animationTime)
        {
            if (!IsOpen)
            {
                return;
            }

            if (_menuViewController != null)
            {
                _menuViewController.ViewWillDisappear(animated);
            }

            Action animation  = () => Animate(_menuViewController.View, ContainerView, 0);
            Action completion = () =>
            {
                IsOpen = false;

                if (ContainerView.Subviews.Length > 0)
                {
                    ContainerView.Subviews[0].UserInteractionEnabled = true;
                }
                ContainerView.RemoveGestureRecognizer(_tapGesture);

                if (_menuViewController != null)
                {
                    _menuViewController.ViewDidDisappear(animated);
                }
            };

            if (animated)
            {
                UIView.Animate(animationTime, 0, AnimationOption, animation, completion);
            }
            else
            {
                animation();
                completion();
            }
        }
Exemplo n.º 3
0
        public void SetOn()
        {
            if (!is_on)
            {
                is_on = true;

                UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                {
                    _back_view.Alpha = 1;
                }, null);

                UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                {
                    _circlebullet.Alpha = 1;
                }, null);

                UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                {
                    _imagebullet.Alpha = 0;
                }, null);
            }
        }
Exemplo n.º 4
0
        public void animateToStack(float duration)
        {
            UIView.Animate(duration: duration,
                           animation: () => {
                for (int i = 1; i < itemsVector.Count; i++)
                {
                    var image = itemsVector [i];

                    var tmp      = itemsVector [0].Center;
                    image.Center = tmp;

                    if (i == itemsVector.Count - 1)
                    {
                        var fullItemWidth        = (Constants.ItemFrameWidth + Constants.ItemSeparation);
                        var PrevCenterOfLastItem = (NumberOfItems * fullItemWidth) - (fullItemWidth / 2.0f);
                        var LastCenterOfLastItem = fullItemWidth / 2.0f;

                        if (!isStack)
                        {
                            StackViewsDidFinish(this, StackNumber, PrevCenterOfLastItem - LastCenterOfLastItem, true);
                        }
                        else
                        {
                            StackViewsDidFinish(this, StackNumber, PrevCenterOfLastItem - LastCenterOfLastItem, false);
                        }
                    }
                }
                foreach (var image in itemsVector)
                {
                    image.UserInteractionEnabled = false;
                }
            });

            var newFrame = Frame;

            newFrame.Width = Constants.ItemFrameWidth + Constants.ItemSeparation;
            Frame          = newFrame;
            isStack        = true;
        }
Exemplo n.º 5
0
        async void LoadBackgroundImage(string Url)
        {
            UIImage image = new UIImage();

            if (String.IsNullOrEmpty(Url))
            {
                image = UIImage.FromBundle("Images/placeholder_image.png");
            }
            else
            {
                using (var httpClient = new HttpClient()) {
                    byte[] data = await httpClient.GetByteArrayAsync(Url);

                    image = data == null?UIImage.FromBundle("Images/placeholder_image.png") : UIImage.LoadFromData(NSData.FromArray(data));
                }
            }
            ImgVwBackground.Image = image;

            UIView.Animate(0.5, 0, UIViewAnimationOptions.CurveEaseIn, delegate {
                ImgVwBackground.Alpha = 1;
            }, null);
        }
Exemplo n.º 6
0
        private async void LoadData()
        {
            titleLabel.Text = CurrentEvent.DisplayName;
            var cs        = new ContentService();
            var sessiones = await cs.GetSessions(CurrentEvent);

            Sessions   = new List <Session>(sessiones.OrderBy(s => s.Starts));
            EventDates = Sessions.Select(s => s.Starts.GetValueOrDefault().Date).Distinct().ToList();
            tableView.ReloadData();

            if (!string.IsNullOrEmpty(CurrentEvent.BannerImage))
            {
                var byteData = await ContentService.DownloadImageArrayAsync(CurrentEvent.BannerImage);

                this.bannerImage.Image = UIImage.LoadFromData(NSData.FromArray(byteData));
                UIView.Animate(1, () =>
                {
                    titleLabel.Alpha  = 0;
                    bannerImage.Alpha = 1;
                }, null);
            }
        }
Exemplo n.º 7
0
        public void SlidePopupTo(nfloat y)
        {
            UIView.Animate(Duration, delegate
            {
                popup.UpdateY(y);

                if (y.Equals(HiddenY))
                {
                    transparentArea.Alpha = 0;
                }
                else
                {
                    transparentArea.Alpha = 0.5f;
                }
            }, delegate
            {
                if (y.Equals(HiddenY))
                {
                    Superview.SendSubviewToBack(this);
                }
            });
        }
Exemplo n.º 8
0
        /// <summary>
        /// Animate the session/job tab and then update the data
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        public void switchSessionTab(object sender, EventArgs e)
        {
            noJobLabel.Hidden            = true;
            jobButton.Enabled            = true;
            jobButton.BackgroundColor    = UIColor.LightGray;
            jobHighlight.BackgroundColor = UIColor.Black;
            jobButton.Font = UIFont.SystemFontOfSize(18);
            sessionButton.BackgroundColor    = UIColor.White;
            sessionButton.Font               = UIFont.BoldSystemFontOfSize(22);
            sessionHighlight.BackgroundColor = UIColor.FromRGB(0, 174, 239);
            sessionButton.Enabled            = false;
            jobTable.Hidden     = true;
            sessionTable.Hidden = false;

            UIView.Animate(.3, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
            }, () => {
                if (!ion.dataLogManager.isRecording)
                {
                    GetAllSessions();
                }
            });
        }
Exemplo n.º 9
0
        private void Open(bool animated, float animationTime)
        {
            if (IsOpen)
            {
                return;
            }

            if (_menuViewController != null)
            {
                _menuViewController.ViewWillAppear(animated);
            }

            NSAction animation  = () => Animate(_menuViewController.View, ContainerView, 1);
            NSAction completion = () =>
            {
                IsOpen = true;
                ContainerView.AddGestureRecognizer(_tapGesture);

                if (_menuViewController != null)
                {
                    _menuViewController.ViewDidAppear(animated);
                }
            };

            if (ContainerView.Subviews.Length > 0)
            {
                ContainerView.Subviews[0].UserInteractionEnabled = false;
            }

            if (animated)
            {
                UIView.Animate(animationTime, 0, AnimationOption, animation, completion);
            }
            else
            {
                animation();
                completion();
            }
        }
Exemplo n.º 10
0
        public void AnimateFlipHorizontally(UIView view, bool isIn, double duration = 0.3, Action onFinished = null)
        {
            var m34 = (nfloat)(-1 * 0.001);

            var minTransform = CATransform3D.Identity;

            minTransform.m34 = m34;
            minTransform     = minTransform.Rotate((nfloat)((isIn ? 1 : -1) * Math.PI * 0.5), (nfloat)0.0f, (nfloat)1.0f, (nfloat)0.0f);
            var maxTransform = CATransform3D.Identity;

            maxTransform.m34 = m34;

            view.Layer.Transform = isIn ? minTransform : maxTransform;
            UIView.Animate(duration, 0, UIViewAnimationOptions.CurveEaseInOut,
                           () =>
            {
                view.Layer.AnchorPoint = new CGPoint((nfloat)0.5, (nfloat)0.5f);
                view.Layer.Transform   = isIn ? maxTransform : minTransform;
            },
                           onFinished
                           );
        }
Exemplo n.º 11
0
 public void openSheet(bool isSort = true)
 {
     TabBarController.TabBar.Hidden = true;
     maskView.Hidden = false;
     if (isSort)
     {
         UIView.Animate(20, () =>
         {
             sortMenu.Transform.Translate(0, -sortMenu.Frame.Size.Height);
             this.View.BringSubviewToFront(sortMenu);
         }, null);
     }
     else
     {
         UIView.Animate(20, () =>
         {
             actionMenu.Transform.Translate(0, -actionMenu.Frame.Size.Height);
             this.View.BringSubviewToFront(actionMenu);
         }, null);
     }
     ((MainTapBarVC)this.TabBarController).button.Hidden = true;
 }
Exemplo n.º 12
0
        public void Hide()
        {
            if (Progress != null)
            {
                Progress.ProgressChanged -= ProgressAction;
                Progress = null;
                if (_loadingView != null)
                {
                    //_loadingView.Progress = 0d;
                }
            }

            UIView.Animate(
                0.25, // duration
                () => { OverlayView.Alpha = 0; },
                () =>
            {
                _loadingView?.RunDismissalAnimation();
                IsRunning = false;
            }
                );
        }
        void UpdateButtomLayoutConstraint(UIKeyboardEventArgs e)
        {
            UIViewAnimationCurve curve = e.AnimationCurve;

            UIView.Animate(e.AnimationDuration, 0, ConvertToAnimationOptions(e.AnimationCurve), () => {
//				SetToolbarContstraint(tableView.Frame.GetMaxY () - e.FrameEnd.GetMinY ());
                SetToolbarContstraint(e.FrameEnd.Height);

                // Move content with keyboard

                /*
                 * var oldOverlap = CalcContentOverlap();
                 * UpdateTableInsets ();
                 * var newOverlap = CalcContentOverlap();
                 *
                 * var offset = tableView.ContentOffset;
                 * offset.Y += newOverlap - oldOverlap;
                 * offset.Y = NMath.Max(offset.Y, 0);
                 * tableView.ContentOffset = offset;
                 */
            }, null);
        }
        //bool isOpen {get{ return mainView.Frame.X == menuWidth; }}

        public void ShowMenu()
        {
            if (mainView == null)
            {
                return;
            }
            EnsureInvokedOnMainThread(delegate
            {
                //navigation.ReloadData ();
                //isOpen = true;
                navigation.View.Hidden = false;
                shadowView.Frame       = mainView.Frame;
                if (!ShouldStayOpen)
                {
                    View.AddSubview(closeButton);
                }
                if (!HideShadow)
                {
                    View.InsertSubviewBelow(shadowView, mainView);
                }
                if (ShowMenuBorder)
                {
                    //menuBorder.Frame = mainView.Frame;
                    //menuBorder.Frame.Width = 1f;
                    View.InsertSubviewBelow(menuBorder, mainView);
                }
            });

            OnBeginAnimation(EventArgs.Empty);
            UIView.Animate(.2, () =>
            {
                UIView.SetAnimationCurve(UIViewAnimationCurve.EaseIn);
                CGRect frame = mainView.Frame;
                frame.X      = Position == FlyOutNavigationPosition.Left ? menuWidth : -menuWidth;
                setViewSize();
                SetLocation(frame);
                shadowView.Frame = frame;
            }, showComplete);
        }
Exemplo n.º 15
0
        private void AnimateCardsForHello(bool forHello)
        {
            AnimateCardOffScreenToTop(forHello, () => {
                _currentMatchIndex++;
                Person nextMatch = CurrentMatch;
                if (nextMatch != null)
                {
                    // Show the next match's profile in the card
                    _cardView.Update(nextMatch);

                    // Ensure that the view's layout is up to date before we animate it
                    View.LayoutIfNeeded();

                    if (UIAccessibility.IsReduceMotionEnabled)
                    {
                        // Fade the card into view
                        FadeCardIntoView();
                    }
                    else
                    {
                        // Zoom the new card from a tiny point into full view
                        ZoomCardIntoView();
                    }
                }
                else
                {
                    // Hide the card
                    _cardView.Hidden = true;

                    // Fade in the "Stay tuned for more matches" blurb
                    UIView.Animate(FadeAnimationDuration, () => {
                        _swipeInstructionsView.Alpha           = 0f;
                        _allMatchesViewedExplanatoryView.Alpha = 1f;
                    });
                }

                UIAccessibility.PostNotification(UIAccessibilityPostNotification.LayoutChanged, null);
            });
        }
Exemplo n.º 16
0
 private void AnimateCallMomButtonColor(UIColor color, string title)
 {
     lock (_lock) {
         nfloat borderwidht = this.CallMomButton.Layer.BorderWidth;
         CallMomButton.Enabled = false;
         CallMomButton.SetTitle(title, UIControlState.Normal);
         CallMomButton.Enabled = true;
         UIView.Animate(1.0f, 0, UIViewAnimationOptions.CurveLinear,
                        () => {
             this.CallMomButton.BackgroundColor   = color;
             this.CallMomButton.Layer.BorderWidth = (borderwidht + 2);
         },
                        () => {
             this.CallMomButton.BackgroundColor   = _defaultCallMomButtonColor;
             this.CallMomButton.Layer.BorderWidth = borderwidht;
             CallMomButton.Enabled = false;
             CallMomButton.SetTitle(_defaultCallMomButtonTitle, UIControlState.Normal);
             CallMomButton.Enabled = true;
         }
                        );
     }
 }
Exemplo n.º 17
0
 public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
 {
     if (keyPath == "contentSize" && context == handle)
     {
         if (tbLicenceCompany.ContentSize.Height == 0)
         {
             consHeightVLicenceCompany.Constant = tbLicenceCompany.ContentSize.Height + 85;
             UIView.Animate(0.5, () =>
             {
                 View.LayoutIfNeeded();
             });
         }
         else
         {
             consHeightVLicenceCompany.Constant = tbLicenceCompany.ContentSize.Height + 85;
         }
     }
     else
     {
         base.ObserveValue(keyPath, ofObject, change, context);
     }
 }
Exemplo n.º 18
0
        public static void ShowToast(this UIView context, UIView toast, double duration, object point)
        {
            toast.Center = CenterPointForPosition(context, point, toast);
            toast.Alpha  = 0.0f;

            if (CSToastHidesOnTap)
            {
                UITapGestureRecognizer recognizer = new UITapGestureRecognizer(() => HandleToastTapped(toast));
                toast.AddGestureRecognizer(recognizer);
                toast.UserInteractionEnabled = true;
                toast.ExclusiveTouch         = true;
            }

            context.AddSubview(toast);
            UIView.Animate(CSToastFadeDuration, 0.0, UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowUserInteraction,
                           () => toast.Alpha = 1.0f,
                           () => {
                Timer timer = new Timer(t => ToastTimerDidFinish(toast));
                timer.Change((int)(duration * 1000), Timeout.Infinite);
            }
                           );
        }
        protected virtual void OnShellSectionPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == ShellSection.CurrentItemProperty.PropertyName)
            {
                var items       = ShellSectionController.GetItems();
                var currentItem = ShellSection.CurrentItem;

                var oldIndex = _currentIndex;
                var oldItem  = items[oldIndex];

                _currentIndex = ShellSectionController.GetItems().IndexOf(currentItem);

                var oldRenderer     = _renderers[oldItem];
                var currentRenderer = _renderers[currentItem];

                // -1 == slide left, 1 ==  slide right
                int motionDirection = _currentIndex > oldIndex ? -1 : 1;

                _containerArea.AddSubview(currentRenderer.NativeView);

                _isAnimating = true;

                currentRenderer.NativeView.Frame = new CGRect(-motionDirection * View.Bounds.Width, 0, View.Bounds.Width, View.Bounds.Height);
                oldRenderer.NativeView.Frame     = _containerArea.Bounds;

                UIView.Animate(.25, 0, UIViewAnimationOptions.CurveEaseOut, () =>
                {
                    currentRenderer.NativeView.Frame = _containerArea.Bounds;
                    oldRenderer.NativeView.Frame     = new CGRect(motionDirection * View.Bounds.Width, 0, View.Bounds.Width, View.Bounds.Height);
                },
                               () =>
                {
                    oldRenderer.NativeView.RemoveFromSuperview();
                    _isAnimating = false;

                    _tracker.Page = ((IShellContentController)currentItem).Page;
                });
            }
        }
Exemplo n.º 20
0
        void moveWithDuration(double duration, SwipeTableViewCellDirection direction)
        {
            isExited = true;
            nfloat origin = 0.0F;

            if (direction == SwipeTableViewCellDirection.Left)
            {
                origin = cell.Bounds.Width.Neg();
            }
            else if (direction == SwipeTableViewCellDirection.Right)
            {
                origin = cell.Bounds.Width;
            }

            var percentage = percentageWithOffset(origin, cell.Bounds.Width);
            var frame      = contentScreenshotView.Frame;

            frame.X = origin;

            // Color
            UIColor color = colorWithPercentage((nfloat)currentPercentage);

            if (color != null)
            {
                colorIndicatorView.BackgroundColor = color;
            }

            UIView.Animate(
                duration,
                0,
                UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowUserInteraction,
                () => {
                contentScreenshotView.Frame = frame;
                slidingView.Alpha           = 0;
                slideViewWithPercentage(percentage, activeView, ShouldAnimateIcons);
            },
                executeCompletionBlock
                );
        }
        public static IDisposable ShowPrivateView(this UIViewController @this)
        {
            var vc = new PrivateRepositoryViewController();

            vc.View.Frame            = new CoreGraphics.CGRect(0, 0, @this.View.Bounds.Width, @this.View.Bounds.Height);
            vc.View.AutoresizingMask = UIViewAutoresizing.All;

            vc.View.Alpha = 0;
            @this.View.Add(vc.View);
            UIView.Animate(0.4, 0, UIViewAnimationOptions.CurveEaseIn, () => vc.View.Alpha = 1, null);
            @this.AddChildViewController(vc);

            vc.View.BackgroundColor = Theme.CurrentTheme.PrimaryColor;

            @this.NavigationItem.RightBarButtonItem.Do(x => x.Enabled = false);

            return(Disposable.Create(() =>
            {
                vc.View.RemoveFromSuperview();
                vc.RemoveFromParentViewController();
            }));
        }
Exemplo n.º 22
0
        // Handle the badge changing value
        void UpdateBadgeValueAnimated(bool animated)
        {
            // Bounce animation on badge if value changed and if animation authorized
            if (animated && this.ShouldAnimateBadge && _badge.Text != this.BadgeValue)
            {
                var animation = new CABasicAnimation();
                animation.KeyPath        = @"transform.scale";
                animation.From           = NSObject.FromObject(1.5);
                animation.To             = NSObject.FromObject(1);
                animation.Duration       = 0.2;
                animation.TimingFunction = new CAMediaTimingFunction(0.4f, 1.3f, 1f, 1f);
                _badge.Layer.AddAnimation(animation, @"bounceAnimation");
            }

            // Set the new value
            _badge.Text = this.BadgeValue;

            // Animate the size modification if needed
            double duration = animated ? 0.2 : 0;

            UIView.Animate(duration, UpdateBadgeFrame);
        }
Exemplo n.º 23
0
        void ToggleCollectionViewVisibility(bool visible, bool animated)
        {
            if (animated)
            {
                View.LayoutIfNeeded();
                CollectionViewHeightConstraint.Constant = (visible) ? 75 : 0;

                UIView.Animate(.25, () =>
                {
                    CollectionView.Alpha = (visible) ? 1 : 0;
                    View.LayoutIfNeeded();
                }, () =>
                {
                    CollectionView.Hidden = (visible) ? false : true;
                });
            }
            else
            {
                CollectionView.Hidden = (visible) ? false : true;
                CollectionViewHeightConstraint.Constant = (visible) ? 75 : 0;
            }
        }
        // MARK: UIScrollViewDelegate
        public override void Scrolled(UIScrollView scrollView)
        {
            //base.Scrolled(scrollView);
            appBar.HeaderViewController.Scrolled(scrollView);
            var scrollOffsetY = scrollView.ContentOffset.Y;
            var opacity       = 0.7f;
            var logoOpacity   = 0.3f;

            if (scrollOffsetY > -240)
            {
                opacity     = 0.3f;
                logoOpacity = 0.7f;
            }

            UIView.Animate(0.5, () => {
                this.headerContentView.backgroundImage.Alpha = opacity;
                this.headerContentView.descLabel.Alpha       = opacity;
                this.headerContentView.titleLabel.Alpha      = opacity;

                this.shrineLogo.Alpha = logoOpacity;
            });
        }
Exemplo n.º 25
0
        /// <summary>
        /// Resets the frame.
        /// </summary>
        /// <param name="animated">If set to <c>true</c> animated.</param>
        private void ResetFrame(Boolean animated)
        {
            var window = UIApplication.SharedApplication.Windows [0];

            this.Frame = window.Frame;

            //
            if (animated)
            {
                UIView.Animate(0.3f, () => {
                    this.Center           = new CGPoint(window.Center.X, window.Center.Y);
                    this.ActualBox.Center = this.Center;
                    mBackingView.Frame    = this.Bounds;
                });
            }
            else
            {
                this.Center           = new CGPoint(window.Center.X, window.Center.Y);
                this.ActualBox.Center = this.Center;
                mBackingView.Frame    = this.Bounds;
            }
        }
Exemplo n.º 26
0
        private void dismissMessage(MessageView messageView, bool clicked)
        {
            if (messageView != null && !messageView.Hit)
            {
                messageView.Hit = true;
                UIView.Animate(DismissAnimationDuration, () => messageView.Frame =
                                   new RectangleF((float)messageView.Frame.X, (float)-(messageView.Frame.Height - messageBarOffset), (float)messageView.Frame.Width, (float)messageView.Frame.Height),
                               () =>
                {
                    messageVisible = false;
                    messageView.RemoveFromSuperview();

                    var action = messageView.OnDismiss;
                    action?.Invoke(clicked);

                    if (messageBarQueue.Count > 0)
                    {
                        showNextMessage();
                    }
                });
            }
        }
Exemplo n.º 27
0
        private async Task Load()
        {
            Web.UserInteractionEnabled = false;
            Web.LoadHtmlString("", NSBundle.MainBundle.BundleUrl);

            _activityView.Alpha = 1;
            _activityView.StartAnimating();
            View.Add(_activityView);

            try
            {
                var response = await _inAppPurchaseService
                               .RequestProductData(FeaturesService.ProEdition)
                               .WithTimeout(TimeSpan.FromSeconds(30));

                var productData = response.Products.FirstOrDefault();
                var enabled     = _featuresService.IsProEnabled;
                var model       = new UpgradeDetailsModel(productData?.LocalizedPrice(), enabled);
                var viewModel   = new UpgradeDetailsRazorView {
                    Model = model
                };
                LoadContent(viewModel.GenerateString());
            }
            catch (Exception e)
            {
                AlertDialogService.ShowAlert("Error Loading Upgrades", e.Message);
            }
            finally
            {
                Web.UserInteractionEnabled = true;

                UIView.Animate(0.2f, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseInOut,
                               () => _activityView.Alpha = 0, () =>
                {
                    _activityView.RemoveFromSuperview();
                    _activityView.StopAnimating();
                });
            }
        }
Exemplo n.º 28
0
        private void TextFieldTextChanged(NSNotification notification)
        {
            var field = (UITextField)notification.Object;

            UIView.Animate(0.1f, () =>
            {
                View.SetNeedsUpdateConstraints();

                if (field.Text.Length > 0)
                {
                    SendRightConstraint.Constant  = _originalSendRightValue + Send.Frame.Width + 10;
                    InputRightConstraint.Constant = _originalInpuRightValue + Send.Frame.Width + 10;
                }
                else
                {
                    SendRightConstraint.Constant  = _originalSendRightValue;
                    InputRightConstraint.Constant = _originalInpuRightValue;
                }

                View.LayoutIfNeeded();
            });
        }
        public void FlipAnimation(UIView view, double duration = 0.5)
        {
            var m34 = (nfloat)(-1 * 0.001);
            var initialTransform = CATransform3D.Identity;

            initialTransform.m34 = m34;
            initialTransform     = initialTransform.Rotate((nfloat)(1 * Math.PI * 0.5), 0.0f, 1.0f, 0.0f);

            view.Alpha           = 0.0f;
            view.Layer.Transform = initialTransform;
            UIView.Animate(duration, 0, UIViewAnimationOptions.CurveEaseInOut,
                           () =>
            {
                view.Layer.AnchorPoint = new CGPoint((nfloat)0.5, 0.5f);
                var newTransform       = CATransform3D.Identity;
                newTransform.m34       = m34;
                view.Layer.Transform   = newTransform;
                view.Alpha             = 1.0f;
            },
                           null
                           );
        }
Exemplo n.º 30
0
        private void HandleScrollingEnded(nfloat velocity)
        {
            var minVelocity = 500;

            if (!IsViewControllerVisible() || (_navBarController.IsContracted() && velocity < minVelocity))
            {
                return;
            }

            _resistanceConsumed = 0;

            if (_currentState == HidingNavigationBarState.Contracting || _currentState == HidingNavigationBarState.Expanding || velocity > minVelocity)
            {
                var contracting = _currentState == HidingNavigationBarState.Contracting;

                if (velocity > minVelocity)
                {
                    contracting = false;
                }

                var deltaY = _navBarController.Snap(contracting);
                var tabBarShouldContract = deltaY < 0;
                _tabBarController?.Snap(tabBarShouldContract);

                var newContentOffset = _scrollView.ContentOffset;
                newContentOffset.Y -= deltaY;

                var contentInset = _scrollView.ContentInset;
                var top          = contentInset.Top + deltaY;

                UIView.Animate(0.2, () =>
                {
                    UpdateScrollContentInsetTop(top);
                    _scrollView.ContentOffset = newContentOffset;
                });

                _previousYOffset = nfloat.NaN;
            }
        }