UIDatePicker控件

用处:选择日期或时间  当选择新的日期或时间的时候,值改变事件会被触发

-(void)viewDidLoad

{

    CGRect frame = CGRectMake(20,20,320,100);

  self.datePicker = [[UIDatePicker alloc]initWithFrame:frame];

  //设置显示模式

  self.datePicker.datePickerMode = UIDatePickerModeDate;

  [self.view addSubView:self.datePicker];

  CGRect framelbl = CGRectMake(0,300,320,50);

  self.label = [[UILable alloc]initWithFrame:framelbl];

  [self.view addSubView:self.label];

  //添加值改变事件

  [self.datePicker addTarget:self action:@selector(change:) forControlEvents:UIControlEventValueChanged];

}

posted @ 2014-08-07 16:53  迷茫的程序小生  阅读(121)  评论(0编辑  收藏  举报