Browse files

Add the ordinal number formatter to the inputField cell.

Also set up the minimum, maximum and the formatter behaviour.
  • Loading branch information...
1 parent 7f152e8 commit 5526d6a855d63558d2be43926e3df733ad8b3605 @Abizern committed Nov 12, 2010
Showing with 13 additions and 1 deletion.
  1. +3 −0 ApplicationDelegate.h
  2. +10 −1 ApplicationDelegate.m
View
3 ApplicationDelegate.h
@@ -6,12 +6,15 @@
//
#import <Cocoa/Cocoa.h>
+@class ADNOrdinalNumberFormatter;
@interface ApplicationDelegate : NSObject <NSApplicationDelegate> {
@private
NSWindow *window;
NSTextField *inputField;
NSInteger number;
+
+ ADNOrdinalNumberFormatter *numberFormatter;
}
View
11 ApplicationDelegate.m
@@ -6,6 +6,7 @@
//
#import "ApplicationDelegate.h"
+#import "ADNOrdinalNumberFormatter.h"
@implementation ApplicationDelegate
@@ -17,9 +18,17 @@ - (id)init {
if (!(self = [super init])) {
return nil; // Bail!
}
- number = 50;
+ number = 50;
+ [numberFormatter = [ADNOrdinalNumberFormatter alloc] init];
+ [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
+ [numberFormatter setMinimum:[NSNumber numberWithInteger:0]];
+ [numberFormatter setMaximum:[NSNumber numberWithInteger:200]];
return self;
}
+- (void)awakeFromNib {
+ [[self.inputField cell] setFormatter:numberFormatter];
+}
+
@end

0 comments on commit 5526d6a

Please sign in to comment.