From 22e1a6fb5dacfdad22d4f02cdc0c21b75c493968 Mon Sep 17 00:00:00 2001 From: Matteo Milesi Date: Wed, 16 Aug 2017 12:39:24 +0200 Subject: [PATCH] Display the correct decimal separator, according to locale, for NSNumber. --- XLForm/XL/Descriptors/XLFormRowDescriptor.m | 1 + XLForm/XL/Helpers/NSNumber+XLFormAdditions.h | 14 ++++++++++++++ XLForm/XL/Helpers/NSNumber+XLFormAdditions.m | 17 +++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 XLForm/XL/Helpers/NSNumber+XLFormAdditions.h create mode 100644 XLForm/XL/Helpers/NSNumber+XLFormAdditions.m diff --git a/XLForm/XL/Descriptors/XLFormRowDescriptor.m b/XLForm/XL/Descriptors/XLFormRowDescriptor.m index af0a959a..35360a67 100644 --- a/XLForm/XL/Descriptors/XLFormRowDescriptor.m +++ b/XLForm/XL/Descriptors/XLFormRowDescriptor.m @@ -27,6 +27,7 @@ #import "XLFormViewController.h" #import "XLFormRowDescriptor.h" #import "NSString+XLFormAdditions.h" +#import "NSNumber+XLFormAdditions.h" CGFloat XLFormUnspecifiedCellHeight = -3.0; CGFloat XLFormRowInitialHeight = -2; diff --git a/XLForm/XL/Helpers/NSNumber+XLFormAdditions.h b/XLForm/XL/Helpers/NSNumber+XLFormAdditions.h new file mode 100644 index 00000000..a3685631 --- /dev/null +++ b/XLForm/XL/Helpers/NSNumber+XLFormAdditions.h @@ -0,0 +1,14 @@ +// +// NSNumber+XLFormAdditions.m +// XLForm ( https://github.com/MatteoMilesi/XLForm ) +// +// Copyright (c) 2017 MatteoMilesi +// + +#import + +@interface NSNumber (XLFormAdditions) + +-(NSString *)displayText; + +@end diff --git a/XLForm/XL/Helpers/NSNumber+XLFormAdditions.m b/XLForm/XL/Helpers/NSNumber+XLFormAdditions.m new file mode 100644 index 00000000..6159325e --- /dev/null +++ b/XLForm/XL/Helpers/NSNumber+XLFormAdditions.m @@ -0,0 +1,17 @@ +// +// NSNumber+XLFormAdditions.m +// XLForm ( https://github.com/MatteoMilesi/XLForm ) +// +// Copyright (c) 2017 MatteoMilesi +// + +#import "NSNumber+XLFormAdditions.h" + +@implementation NSNumber (XLFormAdditions) + +-(NSString *)displayText +{ + return [NSString localizedStringWithFormat:@"%@", self]; +} + +@end