Пример #1
0
        void ReleaseDesignerOutlets()
        {
            if (Column1Button != null)
            {
                Column1Button.Dispose();
                Column1Button = null;
            }

            if (Column2Button != null)
            {
                Column2Button.Dispose();
                Column2Button = null;
            }

            if (Column3Button != null)
            {
                Column3Button.Dispose();
                Column3Button = null;
            }

            if (Column4Button != null)
            {
                Column4Button.Dispose();
                Column4Button = null;
            }

            if (TitleButton != null)
            {
                TitleButton.Dispose();
                TitleButton = null;
            }
        }
        private void RemoveUnusedHeaders()
        {
            switch (Headers.Count)
            {
            case 0:
                Column1Button.RemoveFromSuperview();
                Column2Button.RemoveFromSuperview();
                Column3Button.RemoveFromSuperview();
                Column4Button.RemoveFromSuperview();
                break;

            case 1:
                Column1Button.RemoveFromSuperview();
                Column2Button.RemoveFromSuperview();
                Column3Button.RemoveFromSuperview();
                break;

            case 2:
                Column1Button.RemoveFromSuperview();
                Column2Button.RemoveFromSuperview();
                break;

            case 3:
                Column1Button.RemoveFromSuperview();
                break;

            default:
                break;
            }
        }
        private void SetUpHeaders()
        {
            switch (Headers.Count)
            {
            case 0:
                break;

            case 1:
                Column4Button.SetTitle(Headers[0], UIControlState.Normal);
                break;

            case 2:
                Column3Button.SetTitle(Headers[0], UIControlState.Normal);
                Column4Button.SetTitle(Headers[1], UIControlState.Normal);
                break;

            case 3:
                Column2Button.SetTitle(Headers[0], UIControlState.Normal);
                Column3Button.SetTitle(Headers[1], UIControlState.Normal);
                Column4Button.SetTitle(Headers[2], UIControlState.Normal);
                break;

            default:
                Column1Button.SetTitle(Headers[0], UIControlState.Normal);
                Column2Button.SetTitle(Headers[1], UIControlState.Normal);
                Column3Button.SetTitle(Headers[2], UIControlState.Normal);
                Column4Button.SetTitle(Headers[3], UIControlState.Normal);
                break;
            }
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Column1Button.AddGestureRecognizer(new UITapGestureRecognizer(() => OnColumnClick(Headers.Count - 4)));
            Column1Button.AddGestureRecognizer(new UILongPressGestureRecognizer((r) => OnColumnLongPress(Headers.Count - 4, Column1Button, r)));

            Column2Button.AddGestureRecognizer(new UITapGestureRecognizer(() => OnColumnClick(Headers.Count - 3)));
            Column2Button.AddGestureRecognizer(new UILongPressGestureRecognizer((r) => OnColumnLongPress(Headers.Count - 3, Column2Button, r)));

            Column3Button.AddGestureRecognizer(new UITapGestureRecognizer(() => OnColumnClick(Headers.Count - 2)));
            Column3Button.AddGestureRecognizer(new UILongPressGestureRecognizer((r) => OnColumnLongPress(Headers.Count - 2, Column3Button, r)));

            Column4Button.AddGestureRecognizer(new UITapGestureRecognizer(() => OnColumnClick(Headers.Count - 1)));
            Column4Button.AddGestureRecognizer(new UILongPressGestureRecognizer((r) => OnColumnLongPress(Headers.Count - 1, Column4Button, r)));
        }