从标题

时间:2017-04-11 19:26:03

标签: ios xcode xamarin xamarin.ios

我是xamarin的新手,我有一天陷入这个问题,问题是我有一个活动,其中我有分段控件,我只想删除/隐藏这些分段控件,并在下面分段控件我已经在listview中填充了数据,现在当我以编程方式隐藏或删除分段控件时,listview从segemnted控件隐藏/删除的位置开始,listview不从头开始,下面的快照会给你一个确切的想法。我只是希望列表视图将从标题开始,在此先感谢,任何回复将非常感激。

下面是我的代码:

public override void ViewDidLoad()
    {
        base.ViewDidLoad();


        if (PageViewModel.ShowUShareTab) {
            SegementedControl.InsertSegment("USHARE", 4, false);
        }
        //SegementedControl.Hidden = true
        SegementedControl.RemoveAllSegments();


        UShareTable.RegisterNibForCellReuse(UShareDetailCell.Nib, UShareDetailCell.Key);
        var homeSource1 = new MvxSimpleTableViewSource(UShareTable, UShareDetailCell.Key);
        UShareTable.Source = homeSource1;


        CallDetailsTable.SeparatorStyle = UITableViewCellSeparatorStyle.None;

        CallDetailsTable.RegisterNibForCellReuse(CallDetailCell.Nib, CallDetailCell.Key);
        var homeSource = new MvxSimpleTableViewSource(CallDetailsTable, CallDetailCell.Key);
        CallDetailsTable.Source = homeSource;

        var set = this.CreateBindingSet<TransactionDetailsView, TransactionDetailsViewModel>();
        set.Bind(homeSource).To(vm => vm.TransactionDetails);
        set.Bind(homeSource1).To(vm => vm.UShareQueryResults);
        set.Bind(SegementedControl).For(t => t.SelectedSegment).To(vm => vm.SelectedSegmented);
        set.Bind(this).For(t => t.Title).To(vm => vm.PageTitle);
        set.Bind(Progress).For(t => t.Visible).To(vm => vm.ProgressBarVisibility);
        set.Apply();

        PageViewModel.PropertyChanged+= PageViewModel_PropertyChanged;

        Add(UShareTable);


        SegementedControl.ValueChanged += (sender, e) =>
        {
            var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;


            if (selectedSegmentId == 4)
            {
                CallDetailsTable.Hidden = true;
                if (PageViewModel.UShareQueryResults == null || PageViewModel.UShareQueryResults.Count == 0)
                {
                    PageViewModel.LoadUShareQueryData();
                    UShareTable.Hidden = true;
                }
                else {
                    UShareTable.Hidden = false;
                }
            }
            else 
            {
                UShareTable.Hidden = true;
                CallDetailsTable.Hidden = false;
            }

        };

    }

这是我的Xib文件快照:

enter image description here

我已经扩展了列表视图的高度,但下面没有任何内容是快照:

enter image description here

0 个答案:

没有答案