• UIDatePicker的时间选择器里的时区的问题


    转自:http://www.cocoachina.com/bbs/simple/?t70445.html

    初始化代码:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.
        
        NSDate *now = [NSDate date];
        [_datePicker setDate:now animated:NO];
    }

    显示代码:

    - (IBAction)buttonPressed
    {
        NSDate *selected = [_datePicker date];
        
        NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
        [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm"];
        NSString *theDate = [dateFormat stringFromDate:selected];
        
        NSString *message = [[NSString alloc] initWithFormat:@"The date and time you selected is: %@", theDate];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Date and Time Selected" message:message delegate:nil cancelButtonTitle:@"Yes, I did." otherButtonTitles:nil];
        [alert show];
    }
  • 相关阅读:
    事件的解除与绑定
    JavaScript 继承
    left 和 margin-left
    表格 DOM 操作
    基于继承的拖拽
    碰撞运动
    弹性运动
    完美运动框架
    JS 操作 Cookie
    DIV拖拽
  • 原文地址:https://www.cnblogs.com/wangpei/p/3185046.html
Copyright © 2020-2023  润新知