//设置位置大小
text3 = [[UITextField alloc] initWithFrame:CGRectMake(120,200, 150, 30)];
//设置外观
text3.borderStyle = UITextBorderStyleRoundedRect;
//设置字体大小
text3.font = [UIFont systemFontOfSize:18.0];
//设置清除按钮
text3.clearButtonMode = UITextFieldViewModeWhileEditing;
//键盘样式
text3.keyboardType = UIKeyboardTypeDefault;
//返回键内容
text3.returnKeyType = UIReturnKeyDone;
text3.delegate = self;
//设置默认显示时间
NSDateFormatter *nsformatter = [[NSDateFormatter alloc] init];
[nsformatter setDateFormat:@"yyyy-MM-dd"];
//获取系统当前时间
NSString *dateStr = [nsformatter stringFromDate:[NSDate date]];
text3.text = dateStr;
//添加事件 参数:目标类,方法名,事件(touchDown)
[text3 addTarget:self action:@selector(begin) forControlEvents:UIControlEventTouchDown];
[self.view addSubview:text3];