Пример #1
0
        /// Detects the position of target view relative to its container
        public static TargetPosition GetTargetPosition(this MaterialShowcase materialShowcase, UIView target, UIView container)
        {
            var center = materialShowcase.CalculateCenter(materialShowcase.targetView, container);

            if (center.Y < container.Frame.Height * .5f)
            {
                return(TargetPosition.Above);
            }
            else
            {
                return(TargetPosition.Below);
            }
        }
Пример #2
0
        public static void InitViews(this MaterialShowcase materialShowcase)
        {
            var center = materialShowcase.CalculateCenter(materialShowcase.targetView, materialShowcase.containerView);

            materialShowcase.AddTargetRipple(center);
            materialShowcase.AddTargetHolder(center);
            materialShowcase.AddTarget(center);
            materialShowcase.AddInstructionView(center);
            materialShowcase.instructionView.LayoutIfNeeded();
            materialShowcase.AddBackground();

            // Add gesture recognizer for both container and its subview
            materialShowcase.AddGestureRecognizer(materialShowcase.TapGestureRecoganizer());
            // Disable subview interaction to let users click to general view only
            foreach (var subView in materialShowcase.Subviews)
            {
                subView.UserInteractionEnabled = false;
            }
        }