XSLT存档  

不及格的程序员-八神

 查看分类:  ASP.NET XML/XSLT JavaScripT   我的MSN空间Blog
posts - 173,  comments - 1172,  trackbacks - 0
公告

UIDateicker并没有继承UIPickerView,它的宽度只有iphone的宽度,在ipad上直接显示出来非常不协调,所以苹果建议用UIPopoverViewController来显示,所以你可以在里面任意定制。

在iphone中显示需要手动配制动画,因为它只是一个视图。所以你有下面几种方式显示出一个UIDatePicker.

  • 使用UIView动画块从底部慢慢滑动上来
  • 嵌入到UIAlert或者UIActionSheet中
  • 将UIDateicker视图做为可输入控件的定制键盘,inputView.
  • 最后我的变态方案将两个UIDatePicker一起弹出,形成一个时间区域选择 
    •  1 NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"am_ET"] autorelease];
       2     
       3     
       4     UIDatePicker *datePicker1 = [[[IoriDatePicker alloc] initWithFrame:CGRectMake(-80, 0, 0, 0)] autorelease];
       5     UIDatePicker *datePicker2 = [[[UIDatePicker alloc] initWithFrame:CGRectMake(-80, 0, 0, 0)] autorelease];
       6     CGRect frame = datePicker1.frame;
       7     frame.origin.y = -frame.size.height*0.1/2l;
       8     datePicker1.frame = frame;
       9     datePicker2.frame = frame;
      10     datePicker1.transform =  CGAffineTransformMakeScale (0.9, 0.9);
      11     datePicker2.transform =  CGAffineTransformMakeScale (0.9, 0.9);
      12     
      13     NSTimeZone *timeZone = [[NSTimeZone alloc] initWithName:@"Antarctica/Vostok"];
      14     NSCalendar *calendar = [NSCalendar currentCalendar];
      15     calendar.locale = locale;
      16     calendar.timeZone = timeZone;
      17     datePicker1.calendar = calendar;
      18     
      19     UIView *datePickerContaner = [[[UIView alloc] initWithFrame:CGRectMake(0, 30, 320, datePicker1.frame.size.height)] autorelease];
      20     UIView *datePickerView1 = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, datePickerContaner.frame.size.height)] autorelease];
      21     UIView *datePickerView2 = [[[UIView alloc] initWithFrame:CGRectMake(160, 0, 160, datePickerContaner.frame.size.height)] autorelease];
      22     datePickerView1.clipsToBounds = YES;
      23     datePickerView1.autoresizesSubviews = YES;
      24     datePickerView2.clipsToBounds = YES;
      25     datePickerView2.autoresizesSubviews = YES;
      26     datePickerView1.layer.borderWidth = 1;
      27     datePickerView1.layer.cornerRadius = 8;
      28     datePickerView2.layer.borderWidth = 1;
      29     datePickerView2.layer.cornerRadius = 8;
      30     [datePickerContaner addSubview:datePickerView1];
      31     [datePickerContaner addSubview:datePickerView2];
      32     
      33     
      34     datePicker1.datePickerMode = UIDatePickerModeTime;
      35     [datePickerView1 addSubview:datePicker1];
      36     
      37     
      38     datePicker2.datePickerMode = UIDatePickerModeTime;
      39     [datePickerView2 addSubview:datePicker2];

       

posted on 2013-01-28 10:54 不及格的程序员-八神 阅读(...) 评论(...) 编辑 收藏