ios - Xamarin iOS : how to keep the view active when the loading logo in on the screen

标签 ios xamarin uinavigationcontroller navigation xamarin.ios

在我的 iOS 项目中,页面有一个 ListView ,需要一些时间才能加载。我想显示加载曲线,如图所示 here但它会禁用整个页面,直到它加载为止。我想让用户在加载过程中使用导航按钮返回。

我现在使用的代码是:

var bounds = UIScreen.MainScreen.Bounds; 
loadPop = new LoadingOverlay (bounds);
View.Add (loadPop);
loadingOverlay.Hide ();

有什么办法可以让用户使用导航切换页面,而页面仍然显示加载符号并且数据仍在加载中?

最佳答案

其实很简单。您只需要在列表顶部添加一个 View (带有微调器)并在加载数据时手动将其隐藏。 如果您仍想使用那个 LoadingOverlay 示例,请修改 bounds 参数:

var navigationBarHeight = 48; // not sure what´s the actual height. Google it!
var bounds = UIScreen.MainScreen.Bounds; 
loadPop = new LoadingOverlay (new CGRect(bounds.X, navigationBarHeight, bounds.Width, bounds.Height - navigationBarHeight);
View.Add (loadPop);

如果你只需要微调器,你也可以从你提供的链接中获取一些代码:

activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); // change color here
activitySpinner.Frame = new CGRect (
                centerX - (activitySpinner.Frame.Width / 2) ,
                centerY - activitySpinner.Frame.Height - 20 ,
                activitySpinner.Frame.Width,
                activitySpinner.Frame.Height);
activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
AddSubview (activitySpinner);
activitySpinner.StartAnimating ();

关于ios - Xamarin iOS : how to keep the view active when the loading logo in on the screen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38382599/

相关文章:

ios - 在 ios swift 中实现 Google Analytics

xamarin - xamarin 表单中的 App.AppName

C#:重写初始化方法

iphone - 更改 UINavigationController 过渡效果的正确方法是什么

当我固定导航栏重叠 TableView 时,iOS 7 看不到状态栏(信号、时间、电池)

ios - 如何对齐字符串中的 Logo

android - 使用 Google 云打印从应用程序打印到餐厅的指定打印机

iphone - 从登录服务器验证后切换到新的 View Controller

c# 无法反序列化当前 JSON 对象

javascript - react native : TabBarIOS and Navigation