Example #1
0
        private void Changes(CGPoint point, UIPopoverArrowDirection arrowDirection)
        {
            Frame = _targetView.Bounds;
            CGRect finalFrame  = CGRect.Empty;
            float  arrowHeight = ArrowHeight;
            float  spacing     = Spacing;

            if (arrowDirection == UIPopoverArrowDirection.Right)
            {
                finalFrame.Width  = point.X - arrowHeight;
                finalFrame.Height = _targetView.Bounds.Height;
            }
            else if (arrowDirection == UIPopoverArrowDirection.Left)
            {
                finalFrame.Width  = _targetView.Bounds.Width - point.X - arrowHeight;
                finalFrame.Height = _targetView.Bounds.Height;
                finalFrame.X      = point.X + arrowHeight;
            }
            else if (arrowDirection == UIPopoverArrowDirection.Up)
            {
                finalFrame.Width  = _targetView.Bounds.Width;
                finalFrame.Height = _targetView.Bounds.Height - point.Y - arrowHeight;
                finalFrame.Y      = point.Y + arrowHeight;
            }
            else if (arrowDirection == UIPopoverArrowDirection.Down)
            {
                finalFrame.Width  = _targetView.Bounds.Width;
                finalFrame.Height = point.Y - arrowHeight;
            }
            else
            {
                throw new ArgumentException("********** Invalid arrow direction.");
            }

            finalFrame.X      += spacing;
            finalFrame.Y      += spacing;
            finalFrame.Height -= spacing * 2.0f;
            finalFrame.Width  -= spacing * 2.0f;

            base.Draw(AlignmentRectInsets.InsetRect(finalFrame));

            _scrollViewHost.BackgroundColor = UIColor.White;

            _scrollViewHost.Layer.CornerRadius = HostsCornerRadius;

            _scrollViewHost.Layer.ShadowColor   = UIColor.Black.CGColor;
            _scrollViewHost.Layer.ShadowOffset  = CGSize.Empty;
            _scrollViewHost.Layer.ShadowRadius  = ShadowRadius;
            _scrollViewHost.Layer.ShadowOpacity = ShadowOpacity;

            LayoutSheetForFrame(finalFrame, false, true, true);
            AnchorSheetAtPoint(point, arrowDirection, finalFrame);
        }
Example #2
0
        private void LayoutSheetInitial(bool initial)
        {
            Frame = _targetView.Bounds;

            _scrollViewHost.Layer.CornerRadius  = 0.0f;
            _scrollViewHost.Layer.ShadowOpacity = 0.0f;
            _scrollViewHost.BackgroundColor     = UIColor.Clear;
            CGRect frame = Frame;

            if (_isiPad)
            {
                float fixedWidth = FixedWidth;
                frame.X     = (frame.Width - fixedWidth) / 2.0f;
                frame.Width = fixedWidth;
            }

            base.Draw(AlignmentRectInsets.InsetRect(frame));

            LayoutSheetForFrame(frame, !_isiPad, initial, false);
        }