C# iphone MontTouch UIProgressView 的使用
2011-10-11 18:49
363 查看
想学用C#开发iphone 的就加入 QQ群:178290571 ,让我们共同进步吧!
C# MonoTouch for iphone 开发blog http://blog.csdn.net/ssihc0/
MonoDevelop 版本:2.8.0
MonoTouch 版本:4.2.2
UIProgressView 向用户传达进度信息时。使用这个控件。它提供了一个从左到右逐渐填满的进度条。
常用的属性:
Progress 当前的进度值,取值范围(0.0f-1.0f)
Style 进度条的样式 使用UIProgressViewStyle枚举选择 Default ,Bar 其中的一种样式。
下面是方法和属性:
新建一个工程名为Progress 打开ProgressViewController
添加下面代码:
代码分析:
progress.Style=UIProgressViewStyle.Default; 设置样式
progress.Progress=0.0f; 设置进度开始的指示值
下面是建了一个定时器
NSTimer.CreateRepeatingScheduledTimer(1/10,delegate {
this.timer_call();}
下面是定时器调用的function
private void timer_call()
{
if (progress.Progress>=1.0f) {
progress.Progress=0.0f;
}
progress.Progress += 0.0002f;
}
运行结果:
源代码:
下载
下载后把gif 改成zip
C# MonoTouch for iphone 开发blog http://blog.csdn.net/ssihc0/
MonoDevelop 版本:2.8.0
MonoTouch 版本:4.2.2
UIProgressView 向用户传达进度信息时。使用这个控件。它提供了一个从左到右逐渐填满的进度条。
常用的属性:
Progress 当前的进度值,取值范围(0.0f-1.0f)
Style 进度条的样式 使用UIProgressViewStyle枚举选择 Default ,Bar 其中的一种样式。
下面是方法和属性:
新建一个工程名为Progress 打开ProgressViewController
添加下面代码:
public partial class ProgressViewController : UIViewController { UIProgressView progress; public ProgressViewController (string nibName, NSBundle bundle) : base (nibName, bundle) { } public override void DidReceiveMemoryWarning () { // Releases the view if it doesn't have a superview. base.DidReceiveMemoryWarning (); // Release any cached data, images, etc that aren't in use. } public override void ViewDidLoad () { base.ViewDidLoad (); progress= new UIProgressView(new System.Drawing.RectangleF(30f,35f,200f,45f )); progress.Style=UIProgressViewStyle.Default; progress.Progress=0.0f; NSTimer.CreateRepeatingScheduledTimer(1/10,delegate { this.timer_call(); } ); this.View.AddSubview(progress); //any additional setup after loading the view, typically from a nib. } private void timer_call() { if (progress.Progress>=1.0f) { progress.Progress=0.0f; } progress.Progress += 0.0002f; } public override void ViewDidUnload () { base.ViewDidUnload (); // Release any retained subviews of the main view. // e.g. myOutlet = null; } public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) { // Return true for supported orientations return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown); } }
代码分析:
progress.Style=UIProgressViewStyle.Default; 设置样式
progress.Progress=0.0f; 设置进度开始的指示值
下面是建了一个定时器
NSTimer.CreateRepeatingScheduledTimer(1/10,delegate {
this.timer_call();}
下面是定时器调用的function
private void timer_call()
{
if (progress.Progress>=1.0f) {
progress.Progress=0.0f;
}
progress.Progress += 0.0002f;
}
运行结果:
源代码:
下载
下载后把gif 改成zip
相关文章推荐
- C# iphone MontTouch UIScrollView 的使用
- C# iphone MontTouch UIActivityIndicatorView 的使用
- C# iphone MontTouch UIPicker 的使用
- C# iphone MontTouch UISegmentedControl 的使用
- C# iphone MontTouch UIPageControl 的使用
- iphone UIProgressView 进度使用例子
- iPhone开发 UIProgressView与计时器一起使用
- C# iphone MontTouch UIWebView 的使用
- iphone等待控件(UIActivityIndicatorView与UIProgressView)
- 错误:Only the original thread that created a view hierarchy can touch its views——Handler的使用&用其更新UI
- iOS学习笔记—— UIActivityIndicatorView 和 UIProgressView 的使用
- iOS 之 UIProgressView 使用详解
- swift UIProgressView UISilder UISwitch使用
- iOS--UIProgressView的使用方法详细
- UIProgressView的使用
- iPhone控件之UIProgressView
- 自定义UIProgressView与ASIHttpRequest一起使用
- UIProgressView的使用
- UIProgressView 进度条控件的使用方法
- UIProgressView 的简单使用