我开始使用Xamarin.iOS进行iOS开发,我想知道是否在iOS中有与Android等效的ProgressDialog?ProgressDialog相当于iOS
0
A
回答
2
我认为,
https://components.xamarin.com/view/mbprogresshud/
是最好的选择。你可以从这里
https://components.xamarin.com/gettingstarted/mbprogresshud
编辑1
找到信息下面是我写的一个静态类。希望能对你有所帮助
using CoreGraphics;
using MBProgressHUD;
using System;
using System.Collections.Generic;
using System.Text;
using UIKit;
namespace CandyCaneClub.iOS.Helper
{
/*
A generic helper class to show and hide the overlay for running processes on application
*/
public class OverlayHelper
{
public static MTMBProgressHUD overlay;
//Initialize the Overlay with string as a message to show and view on which we suppose to show
public static MTMBProgressHUD InitOverlay(string message, UIView view)
{
overlay = new MTMBProgressHUD(view)
{
LabelText = message,
RemoveFromSuperViewOnHide = true
};
overlay.Alpha = 0.75f;
view.AddSubview(overlay);
overlay.Show(animated: true);
return overlay;
}
//Hide the overlay
public static void HideOverlay()
{
if(overlay != null)
overlay.Hide(animated: true, delay: 2);
}
}
}
0
This Xamarin.IOS documentation link应该给你你需要建立一个进度对话框的内容。在他们的例子中,进度对话框正在整个屏幕上,但调整了一些参数,你可以使它基本看起来你想要的。
1
Xamarin有一个完整的配方张贴这个确切的看法。 https://developer.xamarin.com/recipes/ios/standard_controls/popovers/display_a_loading_message/
public class LoadingOverlay : UIView {
// control declarations
UIActivityIndicatorView activitySpinner;
UILabel loadingLabel;
public LoadingOverlay (CGRect frame) : base (frame)
{
// configurable bits
BackgroundColor = UIColor.Black;
Alpha = 0.75f;
AutoresizingMask = UIViewAutoresizing.All;
nfloat labelHeight = 22;
nfloat labelWidth = Frame.Width - 20;
// derive the center x and y
nfloat centerX = Frame.Width/2;
nfloat centerY = Frame.Height/2;
// create the activity spinner, center it horizontall and put it 5 points above center x
activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
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();
// create and configure the "Loading Data" label
loadingLabel = new UILabel(new CGRect (
centerX - (labelWidth/2),
centerY + 20 ,
labelWidth ,
labelHeight
));
loadingLabel.BackgroundColor = UIColor.Clear;
loadingLabel.TextColor = UIColor.White;
loadingLabel.Text = "Loading Data...";
loadingLabel.TextAlignment = UITextAlignment.Center;
loadingLabel.AutoresizingMask = UIViewAutoresizing.All;
AddSubview (loadingLabel);
}
/// <summary>
/// Fades out the control and then removes it from the super view
/// </summary>
public void Hide()
{
UIView.Animate (
0.5, // duration
() => { Alpha = 0; },
() => { RemoveFromSuperview(); }
);
}
}
相关问题
- 1. onDestroy()相当于IOS
- 2. RDTSC相当于iOS
- 3. iOS相当于Android MODE_WORLD_READABLE
- 4. Sencha touch相当于iOS UIViewContentModeScaleAspectFit
- 5. CreateFile w/CREATE_NEW相当于iOS?
- 6. iOS相当于Android registerActivityLifecycleCallbacks
- 7. IOS相当于Android的Paint.breakText()
- 8. 相当于iOS中的R
- 9. iOS相当于NFC AAR
- 10. iOS相当于MacOS NSAttributedString initWithRTF
- 11. Android的addJavascriptInterface相当于iOS
- 12. iOS中的System.IO.Path相当于
- 13. Android中的iOS服务相当于Swift
- 14. iOS中的滑动抽屉相当于
- 15. iOS中的NSUserDefaults相当于Android的
- 16. 相当于一个样式表的iOS?
- 17. 什么是iOS中的onDraw相当于
- 18. iOS的相当于Android的SharedPreferences
- 19. iOS/Swift编程相当于Android TableLayout/TableRow
- 20. 相当于IOS中的静态字段
- 21. C#相当于iOS SDK NSDate和NSTimeInterval
- 22. Direct2D相当于iOS OSX开发
- 23. CTFrameGetVisibleStringRange相当于iOS编程吗?
- 24. iOS上的Android服务相当于
- 25. iOS相当于Android的CoordinatorLayout效果
- 26. 的MonoTouch相当于UIViewController的的iOS 5.0
- 27. Progressdialog慢于Android的
- 28. 相当于iOS脚本中RTCMultiConnection的ios库
- 29. 相当于android选项卡列表的IOS相关文章
- 30. .format相当于
用例子更新了答案 – PrafulD