C#iphone UISwitch 的使用
来源:互联网 发布:nas网络存储设备 编辑:程序博客网 时间:2024/05/14 23:26
想学用C#开发iphone 的就加入 QQ群:178290571 ,让我们共同进步吧!
C# MonoTouch for iphone 开发blog http://blog.csdn.net/ssihc0/
MonoDevelop 版本:2.8.0
MonoTouch 版本:4.2.2
UISwitch 是相当简单的控件,它只有开(ON) 关(OFF)状态。UISwitch 具有的属性非常少。我们常用到的是On 属性,这个属性告诉我们当前控件处于ON 还是 OFF 状态。
下面是方法和属性:
新建一个工程名为Switch 打开SwitchViewController
添加下面代码
public override void ViewDidLoad (){base.ViewDidLoad ();var label= new UILabel(new System.Drawing.RectangleF(30f,130f,90,40));label.BackgroundColor= UIColor.Clear;var switch1= new UISwitch( new System.Drawing.RectangleF(30f,30f,90,40));switch1.ValueChanged += delegate(object sender, EventArgs e) {label.Text=switch1.On.ToString();};this.View.AddSubview(switch1);this.View.AddSubview(label);//any additional setup after loading the view, typically from a nib.}
代码分析:
通过switch1.On 返回 当前的状态
switch1.ValueChanged += delegate(object sender, EventArgs e) {
label.Text=switch1.On.ToString();
};
运行结果
源代码:
下载
- C#iphone UISwitch 的使用
- UISwitch的使用
- UISwitch的详细使用
- UISwitch的使用
- UISwitch的使用
- UISwitch 的使用详解
- UISwitch的使用
- UISwitch 的具体使用方式
- swift中UISwitch的使用
- swift中UISwitch的使用
- iphone 自定义UISwitch
- iphone UISwitch开关控件
- iphone 自定义UISwitch
- iPhone How-to:如何更改UISwitch的提示文本
- iPhone How-to:如何更改UISwitch的提示文本
- iPhone How-to:如何更改UISwitch的提示文本
- C#iphone UILabel 的使用
- C#iphone UIButton 的使用
- 关于邮票的背胶
- <meta>标签
- 隐式类型转换&& 负数的补码
- C++不区分大小写比较字符串是否相等
- JAVA基础------IO操作(一)
- C#iphone UISwitch 的使用
- ADS——用AXD进行代码调试
- ASP:FileSystemObject处理文件
- vi操作多文件时切换窗口的技巧
- 深入认识javascript中的eval函数
- SerialPort缓冲区
- linux 服务启动设置
- Adobe Dreamweaver CS5.5 安装方法
- Android CTS 测试