C# iphone MontTouch UIPageControl 的使用
来源:互联网 发布:淘宝直播自我简介 编辑:程序博客网 时间:2024/05/17 02:59
想学用C#开发iphone 的就加入 QQ群:178290571 ,让我们共同进步吧!
C# MonoTouch for iphone 开发blog http://blog.csdn.net/ssihc0/
MonoDevelop 版本:2.8.0
MonoTouch 版本:4.2.2
UIPageControl 为页面控件,向用户提供应用程序中有其他页面的信息。
常用属性:
Pages 分页的总页数;
ValueChanged 事件。分页改的时候触发
下面是方法和属性:
这个control很简单,不多说了,直接上代码
public partial class PageControlViewController : UIViewController{UIPageControl pageControl;UIView view1,view2,view3;public PageControlViewController (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 ();pageControl= new UIPageControl(new System.Drawing.RectangleF(100,20,100,45));pageControl.Pages=3;pageControl.ValueChanged += delegate(object sender, EventArgs e) {Console.WriteLine ("{0}",pageControl.CurrentPage);switch (pageControl.CurrentPage) {case 0:view1.Hidden=true;view2.Hidden=true;view3.Hidden=false;break;case 1:view1.Hidden=true;view2.Hidden=false;view3.Hidden=true;break;case 2:view1.Hidden=false;view2.Hidden=true;view3.Hidden=true;break;default:break;}};view1= new UIView(new System.Drawing.RectangleF(50,100,200,200));view2= new UIView(new System.Drawing.RectangleF(50,100,200,200)); view3= new UIView(new System.Drawing.RectangleF(50,100,200,200));view1.BackgroundColor=UIColor.Yellow ;view2.BackgroundColor=UIColor.Blue;view3.BackgroundColor=UIColor.Red;this.View.AddSubviews(view1,view2,view3);this.View.AddSubview(pageControl);//any additional setup after loading the view, typically from a nib.}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 orientationsreturn (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);}}
运行结果:
源代码:
下载
- C# iphone MontTouch UIPageControl 的使用
- C# iphone MontTouch UIActivityIndicatorView 的使用
- C# iphone MontTouch UISegmentedControl 的使用
- C# iphone MontTouch UIProgressView 的使用
- C# iphone MontTouch UIWebView 的使用
- C# iphone MontTouch UIScrollView 的使用
- C# iphone MontTouch UIPicker 的使用
- C# iphone开发 MontTouch 使用代码创建UIWindow
- Iphone UIPageControl的简单使用
- UIScrollView UIPageControl 的使用
- UIPageControl的使用
- UIScrollView UIPageControl 的使用
- UIScrollView + UIPageControl的使用
- UIPageControl的使用
- UIPageControl的使用
- UIPageControl的简单使用
- UIPageControl的简单使用
- UIScrollView&UIPageControl的使用
- XP,VISTA,WIN7 远程踢 2003用户
- 超酷的天气预报
- oracle里的数组
- BAPI me21n vl10b vl02n
- 制作对话框与视图结合的分割窗口
- C# iphone MontTouch UIPageControl 的使用
- python 学习之读串口
- 利用ServletContextListener 获取spring上下文
- C语言、UNIX之父丹尼斯·里奇
- How to resolve Time_Wait issue when you use TcpListener and TcpClient
- weblogic 手动发布 Eclipse下的工程
- VS2005断点无法调试
- 算法--冒泡排序 Bubble Sort
- 使用NSThread起线程