C#iphone UIButton 的使用
2011-10-07 16:55
232 查看
想学用C#开发iphone 的就加入 QQ群:178290571 ,让我们共同进步吧!
C# MonoTouch for iphone 开发blog http://blog.csdn.net/ssihc0/
MonoDevelop 版本:2.8.0
MonoTouch 版本:4.2.2
UIButton 不用多说,,和我们在windows button 一样,只是在iso 里它漂亮多了
Title 显示的文本。
Image 按钮上显示的图片。
Background 用作按钮背景的图片。
TextColor 指定文本颜色。
Shadow 阴影 指定特定的颜色。
UIButtonType
Custom, 没有按钮样式,
RoundedRect, 带有圆角和居中标题的矩形按钮。用手所有通用按钮。
DetailDisclosure, 还有居中燕尾形(>)的圆形按钮。
InfoLight,
InfoDark,
ContactAdd
下面是方法和属性:
UIButton 经常用到 TouchUpInside 事件,,,当手按下,抬起的时候触发TouchUpInside事件
新建一个工程名为Button 打开ButtonViewController
添加下面代码
分析代码:
button.TouchUpInside+= button_Click; 事件关联。
运行结果
源代码:
下载
下载后把gif 改成zip
C# MonoTouch for iphone 开发blog http://blog.csdn.net/ssihc0/
MonoDevelop 版本:2.8.0
MonoTouch 版本:4.2.2
UIButton 不用多说,,和我们在windows button 一样,只是在iso 里它漂亮多了
Title 显示的文本。
Image 按钮上显示的图片。
Background 用作按钮背景的图片。
TextColor 指定文本颜色。
Shadow 阴影 指定特定的颜色。
UIButtonType
Custom, 没有按钮样式,
RoundedRect, 带有圆角和居中标题的矩形按钮。用手所有通用按钮。
DetailDisclosure, 还有居中燕尾形(>)的圆形按钮。
InfoLight,
InfoDark,
ContactAdd
下面是方法和属性:
UIButton 经常用到 TouchUpInside 事件,,,当手按下,抬起的时候触发TouchUpInside事件
新建一个工程名为Button 打开ButtonViewController
添加下面代码
private UILabel label1; public ButtonViewController (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 (); label1= new UILabel(); label1.Text= "click"; label1.Frame=new System.Drawing.RectangleF(35f,130f,250f,40f); var button =UIButton.FromType (UIButtonType.RoundedRect); var frame=new System.Drawing.RectangleF(35f,30f,250f,40f); button.Frame=frame; button.SetTitle ("Button",UIControlState.Normal); button.TouchUpInside+= button_Click; this.View.AddSubview(button); this.View.AddSubview(label1); //any additional setup after loading the view, typically from a nib. } private void button_Click( object sender, EventArgs e) { label1.Text= "clicked"; }
分析代码:
button.TouchUpInside+= button_Click; 事件关联。
运行结果
源代码:
下载
下载后把gif 改成zip
相关文章推荐
- iphone开发 UIButton使用
- C# iphone MontTouch UIScrollView 的使用
- C#iphone UISwitch 的使用
- C# iphone MontTouch UIPicker 的使用
- C#iphone UILabel 的使用
- C#iphone UITextField 的使用
- 使用c#,WPF,模仿IPhone的Loading(加载)效果
- C# iphone MontTouch UIProgressView 的使用
- C#iphone UISlider 的使用
- iphone开发之UIButton按钮的使用(一)拖线实现 多个按钮分别用多个方法实现事件监听
- 我的iphone开发学习笔记(二)使用UITextView, UITextField 和UIButton控件
- C# iphone MontTouch UIActivityIndicatorView 的使用
- C# iphone MontTouch UISegmentedControl 的使用
- iphone开发之UIButton按钮的使用(二)拖线实现 多个按钮用同一个监听方法实现
- C#使用iphone-plist-net库读写plist文件
- iPhone开发 如何在XCode中使用UIButton
- C# iphone MontTouch UIPageControl 的使用
- C# iphone开发 MontTouch 使用代码创建UIWindow
- iphone开发之UIButton按钮的使用(三)拖线实现 center和bounds实现控制组件的大小和位置
- C# iphone MontTouch UIWebView 的使用