iphone开发 UIDatePicker UIPickerView使用(持续更新中)

一. UIDatePicker

UIDatePicker模式:

 

1.    UIDatePickerModeTime

 

  

 

2.    UIDatePickerModeDate

 

 

 

3.    UIDatePickerModeDateAndTime

 

 

4.    UIDatePickerModeCountDownTimer

 

 

 

2. 以下是在苹果官网UICatalog例子中看到的比较好的创建UIDatePicker代码:

 

- (void)createDatePicker

{

    datePickerView =[[UIDatePicker alloc] initWithFrame:CGRectZero];

    datePickerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;

    datePickerView.datePickerMode = UIDatePickerModeDate;

   

    //note we are using CGRectZero for the dimensions of our picker view,

    //this is because picker views have a built in optimum size,

    //you just need to set the correct origin in your view.

    //

    //position the picker at the bottom

    CGSizepickerSize = [myPickerView sizeThatFits:CGSizeZero];

    datePickerView.frame =[self pickerFrameWithSize:pickerSize];

   

    //add this picker to our view controller, initially hidden

    datePickerView.hidden = YES;

    [self.view addSubview:datePickerView];

}

 

二. UIPickerView

基本操作很简单,这里不在多说,下面是我在论坛看到的一个写的比较好的自定义的UIPicakerView 需要的时候可以参考下

原文连接:http://www.cocoachina.com/bbs/read.php?tid=85374

 

 

 

 

 

 

你可能感兴趣的:(原创,iphone开发)