mono touch中UIProgressView的使用
2013-12-10 10:33
148 查看
有不明白的地方欢迎入群 347636249 探讨
using System; // using MonoTouch.UIKit; using MonoTouch.Foundation; using System.Drawing; namespace GCForum { public class MyTestVC :UIViewController { public MyTestVC () { } private UIProgressView _progressView; private UIButton btn; public override void ViewDidLoad () { base.ViewDidLoad (); this.View.BackgroundColor = UIColor.White; _progressView = new UIProgressView (new RectangleF (10, 200, this.View.Frame.Width - 20, 10)); _progressView.Style = UIProgressViewStyle.Default; _progressView.TrackTintColor = UIColor.Black; //UIProgressView显示颜色(轨道颜色) _progressView.ProgressTintColor = UIColor.Red; //进度条的颜色 //_progressView.Center = this.View.Center; this.View.AddSubview (_progressView); btn = xxxx.ControlCenter.CreateButton (new RectangleF (120, 250, 80, 35), "Test", "", UIColor.Black); btn.TouchUpInside += HandlerShowActivityButtonTouchUpInside; this.View.Add (btn); } void HandlerShowActivityButtonTouchUpInside(object sender, EventArgs e) { System.Threading.Thread t = new System.Threading.Thread (DoSomethingElse); t.Start (); this.btn.Enabled = false; } void DoSomethingElse() { int n = 3; for (int i=0; i<n; i++) { System.Threading.Thread.Sleep (1000); using (var pool=new NSAutoreleasePool()) { //this.InvokeOnMainThread (delegate { // _progressView.Progress = (float)(i + 1 / n); //}); //===============>匿名表达式 InvokeOnMainThread (() => { _progressView.Progress = (float)(i + 1) / n; }); } } } //... } }
相关文章推荐
- swift中UIProgressView的使用
- 我的开发笔记---UIProgressView的详细使用
- swift中UIProgressView的使用
- androidUI第三部分---1.3.2不使用xml文件手工代码实现布局
- UiPickerView基本使用方法
- android高仿微信UI点击头像显示大图片效果, Android 使用ContentProvider扫描手机中的图片,仿微信显示本地图片效果
- 在ASP.NET MVC 4中使用Kendo UI Grid
- AndroidUI 侧滑菜单 DrawerLayout的使用
- Android开发UI之常用控件的使用
- Revit二次开发——使用IExternalApplication定制UI
- Android的线程使用来更新UI----Thread、Handler、Looper、TimerTask等
- swagger-UI在springMVC结构中的使用
- Eclipse插件开发之org.eclipse.ui.editorActions使用
- iOS开发UI之Quartz2D使用(绘制基本图形)
- Kendo UI 使用札记
- Runtime实例之-UIMenuController的使用
- UNITY3D使用NGUI制作自适应UI的总结
- weui之Picker的使用教程
- IOS学习之UIPickerView控件的简单使用
- Android UI开发第三十篇——使用Fragment构建灵活的桌面