Exemple #1
0
        private void CreateView()
        {
            View = new UIView(new CGRect(0, 0, 600, 600))
            {
                ContentMode      = UIViewContentMode.ScaleToFill,
                BackgroundColor  = Consts.ColorMainBg,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
            };

            _busyContainer = new UIView(new CGRect(0, 0, 600, 600))
            {
                BackgroundColor   = UIColor.FromRGBA(0, 0, 0, 127),
                AutoresizingMask  = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                AutosizesSubviews = true
            };
            _busy = new UIActivityIndicatorView(new CGRect(0, 0, 30, 30))
            {
                HidesWhenStopped = false,
                Center           = new CGPoint(300, 300),
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
            };
            _busy.StartAnimating();
            _busyLabel = new UILabel(new CGRect(0, 0, 600, 30))
            {
                TextAlignment    = UITextAlignment.Center,
                Center           = new CGPoint(300, 330),
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                TextColor        = UIColor.White
            };
            _busyContainer.AddSubviews(_busy, _busyLabel);
            Add(_busyContainer);
            //filter
            _filterView = new UIView()
            {
                BackgroundColor = UIColor.White,
            };
            _filterOpenButton = new UIBarButtonItem("Filters", UIBarButtonItemStyle.Bordered, ShowHideFilter);
            NavigationItem.RightBarButtonItem = _filterOpenButton;
            //overlay
            _overlayView = new UIView()
            {
                BackgroundColor = UIColor.FromRGBA(0, 0, 0, 150)
            };
            _overlayView.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                ShowHideFilter(_overlayView, new EventArgs());
            }));
            //table filters
            _filtersList                 = new UITableView(new RectangleF(0, 0, 25, 25), UITableViewStyle.Grouped);
            _filtersList.Source          = new FilterSource(GetFilters());
            _filtersList.RowHeight       = FilterCell.CellHeight;
            _filtersList.BackgroundColor = Consts.ColorMainBg;
            _filtersList.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
            _filtersList.ScrollEnabled   = true;
            _filterView.Add(_filtersList);
            //clear all filters
            _clearAll            = UICreator.CreateSimpleButton("Clear all");
            _clearAll.TouchDown += ClearAllFilters;
            _filterView.Add(_clearAll);
            //apply filters
            _applyFilters = UICreator.CreateSimpleButton("Done");
            _applyFilters.BackgroundColor = Consts.ColorDivider;
            _applyFilters.SetTitleColor(UIColor.White, UIControlState.Normal);
            _applyFilters.Layer.BorderWidth = 0;
            _applyFilters.TouchDown        += ApplyFilters;
            _filterView.Add(_applyFilters);
        }