iOS10 swift之后的额外点数

时间:2016-12-12 11:11:43

标签: swift xcode ios10

我使用以下代码来获取日期并将其存储在String()

let date = self.getDateFromStringWithFormatted(self.startDate, format: "dd-MM-yyyy")

适用于iOS9 它显示日期= "30-Dec-16" 和 适用于iOS10 它显示日期,如= "30-Dec.-2016"

对于iOS10,它会在月.

之后显示额外的Dec

任何人都可以帮助我为什么会这样。 我需要其中之一 iOS9中的.或iSO10中的.

提前致谢。

这是屏幕截图。

iOS9

enter image description here

iOS10

enter image description here

2 个答案:

答案 0 :(得分:2)

首先,"dd-MM-yyyy"格式不会产生三个字母的缩写。也许您使用"dd-MMM-yyyy"格式。在这种情况下,没有人说在所有语言中都会有三个没有点的字母。如果要在每台计算机上显示20-Dec-16,请将区域设置设置为en_US_POSIX

答案 1 :(得分:2)

设置本地标识符

timer=[NSTimer scheduledTimerWithTimeInterval:yourtime target:self selector:@selector(showAlert) userInfo:nil repeats:NO]; -(void)showAlert { [timer invalidate]; [self.presentationController showAdvertsWithOfferID:self.offerDetailViewController.offer.offerID completionBlock:nil]; } // IF格式为“dd MMM yyyy”或“dd MMM”

应显示“2016年12月21日”或“12月21日”

For More reference