Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在celander中选择日期是使用iOS中的Vurig日历库为我提供以前的日期_Ios_Objective C_Nscalendar - Fatal编程技术网

在celander中选择日期是使用iOS中的Vurig日历库为我提供以前的日期

在celander中选择日期是使用iOS中的Vurig日历库为我提供以前的日期,ios,objective-c,nscalendar,Ios,Objective C,Nscalendar,我已经下载了这个库。现在我面临的问题是,例如,如果我选择2013年2月25日,它将打印2013年2月24日。我在代码中找不到任何东西。是因为时区还是与编码无关的原因?? 请告知 谢谢您遇到时区问题,可以通过添加以下代码行来解决: [格式化程序设置时区:[NSTimeZone timeZoneWithName:@“GMT”] 更新 这很容易做到。在VRGCalendarView.m中,转到方法 - (void)drawRect:(CGRect)rect { int firstWeek

我已经下载了这个库。现在我面临的问题是,例如,如果我选择2013年2月25日,它将打印2013年2月24日。我在代码中找不到任何东西。是因为时区还是与编码无关的原因?? 请告知


谢谢

您遇到时区问题,可以通过添加以下代码行来解决:

[格式化程序设置时区:[NSTimeZone timeZoneWithName:@“GMT”]

更新


  • 这很容易做到。在
    VRGCalendarView.m
    中,转到方法

    - (void)drawRect:(CGRect)rect {
        int firstWeekDay = [self.currentMonth firstWeekDayInMonth]-1;
    }
    
    将此更改为:

    int firstWeekDay = [self.currentMonth firstWeekDayInMonth];
    

    把这个换成

    int selectedDateBlock = ([selectedDate day]-2)+firstWeekDay;
    

    谢谢你的帮助,但是即使粘贴了这个代码,我仍然有同样的问题。只需使用GMT它可能会对你有所帮助。上面所有的建议仍然不起作用。谢谢,谢谢,谢谢,朋友。所有三个链接都非常有帮助,切中要害。学到了很多,谢谢。你一开始是对的,而不是NSDateFormatter的时区,我只需要更改NSDateComponents时区。[components setTimeZone:[NSTimeZone timeZoneWithName:@“GMT”];而且工作起来不太好。再次感谢
    int selectedDateBlock = ([selectedDate day]-2)+firstWeekDay;