【问题标题】:UIRefreshControl not showing Xamarin with DialogViewController below iOS 10UIRefreshControl 未在 iOS 10 以下显示带有 DialogViewController 的 Xamarin
【发布时间】:2017-09-21 11:35:06
【问题描述】:

我是 Xamarin iOS 开发的新手,我们有一个旧代码,他们在其中使用 DialogViewController 创建了所有 tableview。 ViewController 层次结构如下:PQR 派生自 ABC,ABC 派生自 DialogViewController。现在我想为包含 ABC 对象的 PQR 视图控制器显示 refreshControl。

我在 PQR 视图控制器中创建了一个 ABC 视图控制器的对象。

        abcDVC = new ABCDVC (this);
        tableRefreshControl = new UIRefreshControl ();

        if (IsIOS10OrGreater)
            abcDVC.RefreshControl = tableRefreshControl;

        tableRefreshControl.ValueChanged += LoadNotesAsync;

我没有收到任何错误。但是当用户拉下表格时,我的 refreshControl 不可见。它以前工作过,现在停止工作。

提前谢谢你。

【问题讨论】:

    标签: ios xamarin xamarin.ios uirefreshcontrol dialogviewcontroller


    【解决方案1】:

    能够找出它的根本原因。 RefreshControl API 适用于 iOS 10 及更高版本。因此,要将 refreshControl 添加到 iOS 版本

        tableRefreshControl = new UIRefreshControl(); 
        tableRefreshControl.AddTarget((sender, args) =>  GetData(),  UIControlEvent.ValueChanged); 
    
        if (IsIOS10OrGreater)
        { 
           abcDVC.TableView.RefreshControl = tableRefreshControl; 
        } else { 
              TableView.AddSubview(tableRefreshControl); 
        }
    

    【讨论】:

      猜你喜欢
      • 2021-04-10
      • 1970-01-01
      • 1970-01-01
      • 2017-01-22
      • 1970-01-01
      • 2017-01-24
      • 1970-01-01
      • 2015-02-02
      相关资源
      最近更新 更多