zoukankan      html  css  js  c++  java
  • UIDatePicker日期选取器

     1 //定义显示日期的格式
     2 NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
     3 //NSDateFormatterMediumStyle的显示格式为:  Nov 23, 1937” or “3:30:32 PM
     4 dateFormat.dateStyle = NSDateFormatterMediumStyle;
     5 dateFormat.timeStyle = NSDateFormatterMediumStyle;
     6     
     7 //获取事件选取器的值
     8 NSDate *date = self.datePicker.date;
     9 //将date按dateFormat的格式转换成NSString对象显示并赋给message
    10 NSString *message = [dateFormat stringFromDate:date];
    11 
    12 UIAlertController *dateAlert = [UIAlertController alertControllerWithTitle:@"提示" message:message preferredStyle:UIAlertControllerStyleAlert];
    13     
    14 UIAlertAction *dateAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:nil];
    15     
    16 [dateAlert addAction:dateAction];
    17     
    18 [self presentViewController:dateAlert animated:YES completion:nil]; 
  • 相关阅读:
    Django之权限用法
    Django之stark组件的使用和总结
    Django之stark组件2
    Wmic
    Powershell + HTA
    IFG以太网帧间隙
    python编译报错
    C# 格式化XML方法
    C#开发中常用的加密解密方法
    面试题
  • 原文地址:https://www.cnblogs.com/MrHead/p/5753296.html
Copyright © 2011-2022 走看看