关于数据的传递 Outlets 的使用步骤

 

1.  建立控件  比如设计界面拖入 UITextField 控件

2.  ViewControler.h 中声明此Outlets

 

@interface OutletsAndActionsViewController : UIViewController {

//---declaring the outlet---

IBOutlet UITextField *txtName; }

 

3.  ViewControler.h 中声明使用此Outlets的属性

 

//---expose the outlet as a property---

@property (nonatomic, retain) UITextField *txtName;

 

4. ViewController.m中 获取此属性值

@synthesize txtName;

 

5.  制作使用此变量的代码

    使用方式 txtName.text

6. 把控件与Outlets相关联

    关联方法:在 Files'Owner 上点右键,会看到自己声明的 txtName ,拖住后面的点,拖到控件上,即可

 

感谢 “疯狂的老九”大大

http://www.mecil9.com/archives/80.aspx

 

posted on 2011-08-09 10:02  晃晃悠悠  阅读(135)  评论(0)    收藏  举报