Пример #1
0
        public static void AddInstructionView(this ShowCase materialShowcase, CGPoint atCenter)
        {
            materialShowcase.instructionView      = new ShowCaseInstructionView();
            materialShowcase.instructionView.text = materialShowcase.config.ViewText;

            // Calculate x position

            float xPosition = ShowCase.LabelMargin;

            // Calculate y position
            float yPosition;

            if (materialShowcase.config.TextVerticalPosition != VerticalPosition.Top)
            {
                yPosition = (float)atCenter.Y + ShowCase.TextCenterOffset;
            }
            else
            {
                yPosition = (float)atCenter.Y - ShowCase.TextCenterOffset - ShowCase.LabelDefaultHeight * 2;
            }

            materialShowcase.instructionView.Frame = new CGRect(
                xPosition,
                yPosition,
                materialShowcase.containerView.Frame.Width - (xPosition + xPosition),
                (materialShowcase.containerView.Frame.Height / 2));
            materialShowcase.AddSubview(materialShowcase.instructionView);
        }
Пример #2
0
        /// Create a copy view of target view
        /// It helps us not to affect the original target view
        public static void AddTarget(this ShowCase materialShowcase, CGPoint atCenter)
        {
            materialShowcase.targetCopyView = materialShowcase.targetView.SnapshotView(true);
            var width  = materialShowcase.targetCopyView.Frame.Width;
            var height = materialShowcase.targetCopyView.Frame.Height;

            materialShowcase.targetCopyView.Frame  = new CGRect(0, 0, width, height);
            materialShowcase.targetCopyView.Center = atCenter;
            materialShowcase.targetCopyView.TranslatesAutoresizingMaskIntoConstraints = true;
            materialShowcase.targetCopyView.Frame             = RectangleFExtensions.Inset(materialShowcase.targetCopyView.Frame, -5f, -5f);
            materialShowcase.targetCopyView.Layer.BorderColor = UIColor.White.CGColor;
            materialShowcase.targetCopyView.Layer.BorderWidth = 5f;
            materialShowcase.AddSubview(materialShowcase.targetCopyView);
        }