是否有可能首先设定自定义周刊? 我应该继承NSCalendar?
现在我必须在我需要使用NSCalendar
的每个地方都这样设置col_with_nulls = df.agg(*[(1 - (fn.count(c) / fn.count('*')))
for c in cols_to_categorise]).rdd
答案 0 :(得分:1)
您可以使用惰性实例化变量编写NSCalendar
类别:
@interface NSCalendar (WeekdayCalendar)
+ (NSCalendar *)customWeekdayCalendar;
@end
@implementation NSCalendar (WeekdayCalendar)
+ (NSCalendar *)customWeekdayCalendar
{
static NSCalendar *customCalendar = nil;
if (customCalendar == nil) {
customCalendar = [self currentCalendar];
customCalendar.firstWeekday = [NSUserDefaultsHelper firstDayOfWeek];
}
return customCalendar;
}
@end
然后你可以使用来自世界各地的日历
NSCalendar *myCalendar = [NSCalendar customWeekdayCalendar];