Beispiel #1
0
        public override UIView GetViewForHeader(UITableView tableView, nint section)
        {
            PresentationFacetResult facet = _presentationFacetResultList[(int)section];

            HeaderCell header = tableView.DequeueReusableHeaderFooterView(HeaderCell.Key) as HeaderCell;

            header.label.Text = facet.FacetDisplayName;


            if (_isSectionOpen[(int)section])
            {
                header.arrowBuuton.SetImage(UIImage.FromBundle("grey_arrow-down-icon.png"), UIControlState.Normal);
            }
            else
            {
                header.arrowBuuton.SetImage(UIImage.FromBundle("grey_arrow-right-icon.png"), UIControlState.Normal);
            }



            foreach (var view in header.Subviews)
            {
                if (view is HiddenHeaderButton)
                {
                    view.RemoveFromSuperview();
                }
            }
            var hiddenButton = CreateHiddenHeaderButton(header.Bounds, section);

            header.AddSubview(hiddenButton);
            return(header);
        }
Beispiel #2
0
        public ExpandableTableSource(List <PresentationFacetResult> aPresentationFacetResultList, UITableView tableView, RefineViewController aRefineViewController)
        {
            _presentationFacetResultList = aPresentationFacetResultList;
            _isSectionOpen = new bool[aPresentationFacetResultList.Count];

            _refineViewController = aRefineViewController;

            tableView.RegisterNibForCellReuse(UINib.FromName(RefineCell.Key, NSBundle.MainBundle), RefineCell.Key);
            tableView.RegisterNibForHeaderFooterViewReuse(UINib.FromName(HeaderCell.Key, NSBundle.MainBundle), HeaderCell.Key);

            _headerButtonCommand = (sender, e) =>
            {
                var button  = sender as UIButton;
                var section = button.Tag;
                _isSectionOpen[(int)section] = !_isSectionOpen[(int)section];

                HeaderCell headeCell = (HeaderCell)button.Superview;

                if (_isSectionOpen[(int)section])
                {
                    headeCell.arrowBuuton.SetImage(UIImage.FromBundle("grey_arrow-down-icon.png"), UIControlState.Normal);
                }
                else
                {
                    headeCell.arrowBuuton.SetImage(UIImage.FromBundle("grey_arrow-right-icon.png"), UIControlState.Normal);
                }


                tableView.ReloadData();

                // Animate the section cells
                var paths = new NSIndexPath[RowsInSection(tableView, section)];
                for (int i = 0; i < paths.Length; i++)
                {
                    paths[i] = NSIndexPath.FromItemSection(i, section);
                }

                tableView.ReloadRows(paths, UITableViewRowAnimation.Automatic);
            };
        }