/External/Processors/UITextFieldProcessor.m

http://github.com/juancruzmdq/objc-generator · Objective C · 102 lines · 89 code · 6 blank · 7 comment · 33 complexity · 6e877e39f0d8aa46594459229df64c72 MD5 · raw file

  1. //
  2. // UITextFieldProcessor.m
  3. // nib2objc
  4. //
  5. // Created by Adrian on 3/14/09.
  6. // Adrian Kosmaczewski 2009
  7. //
  8. #import "UITextFieldProcessor.h"
  9. #import "NSString+Nib2ObjcExtensions.h"
  10. #import "NSNumber+Nib2ObjcExtensions.h"
  11. #import "NSDictionary+Nib2ObjcExtensions.h"
  12. @implementation UITextFieldProcessor
  13. - (void)dealloc
  14. {
  15. [super dealloc];
  16. }
  17. - (NSString *)getProcessedClassName
  18. {
  19. return @"UITextField";
  20. }
  21. - (void)processKey:(id)item value:(id)value
  22. {
  23. if ([item isEqualToString:@"text"])
  24. {
  25. [output setObject:[OGInstruction initWithStringLocalized:[value quotedAsCodeString]] forKey:item];
  26. }
  27. else if ([item isEqualToString:@"placeholder"])
  28. {
  29. [output setObject:[OGInstruction initWithStringLocalized:[value quotedAsCodeString]] forKey:item];
  30. }
  31. else if ([item isEqualToString:@"textAlignment"])
  32. {
  33. [output setObject:[OGInstruction initWithString:[value textAlignmentString]] forKey:item];
  34. }
  35. else if ([item isEqualToString:@"textColor"])
  36. {
  37. [output setObject:[OGInstruction initWithString:[value colorString]] forKey:item];
  38. }
  39. else if ([item isEqualToString:@"font"])
  40. {
  41. [output setObject:[OGInstruction initWithString:[value fontString]] forKey:item];
  42. }
  43. else if ([item isEqualToString:@"borderStyle"])
  44. {
  45. [output setObject:[OGInstruction initWithString:[value borderStyleString]] forKey:item];
  46. }
  47. else if ([item isEqualToString:@"clearsOnBeginEditing"])
  48. {
  49. [output setObject:[OGInstruction initWithString:[value booleanString]] forKey:item];
  50. }
  51. else if ([item isEqualToString:@"adjustsFontSizeToFitWidth"])
  52. {
  53. [output setObject:[OGInstruction initWithString:[value booleanString]] forKey:item];
  54. }
  55. else if ([item isEqualToString:@"minimumFontSize"])
  56. {
  57. [output setObject:[OGInstruction initWithString:[value floatString]] forKey:item];
  58. }
  59. else if ([item isEqualToString:@"textInputTraits.enablesReturnKeyAutomatically"])
  60. {
  61. [output setObject:[OGInstruction initWithString:[value booleanString]] forKey:@"enablesReturnKeyAutomatically"];
  62. }
  63. else if ([item isEqualToString:@"textInputTraits.secureTextEntry"])
  64. {
  65. [output setObject:[OGInstruction initWithString:[value booleanString]] forKey:@"secureTextEntry"];
  66. }
  67. else if ([item isEqualToString:@"textInputTraits.keyboardAppearance"])
  68. {
  69. [output setObject:[OGInstruction initWithString:[value keyboardAppearanceString]] forKey:@"keyboardAppearance"];
  70. }
  71. else if ([item isEqualToString:@"textInputTraits.returnKeyType"])
  72. {
  73. [output setObject:[OGInstruction initWithString:[value returnKeyTypeString]] forKey:@"returnKeyType"];
  74. }
  75. else if ([item isEqualToString:@"textInputTraits.autocapitalizationType"])
  76. {
  77. [output setObject:[OGInstruction initWithString:[value autocapitalizationTypeString]] forKey:@"autocapitalizationType"];
  78. }
  79. else if ([item isEqualToString:@"textInputTraits.autocorrectionType"])
  80. {
  81. [output setObject:[OGInstruction initWithString:[value autocorrectionTypeString]] forKey:@"autocorrectionType"];
  82. }
  83. else if ([item isEqualToString:@"textInputTraits.keyboardType"])
  84. {
  85. [output setObject:[OGInstruction initWithString:[value keyboardTypeString]] forKey:@"keyboardType"];
  86. }
  87. else if ([item isEqualToString:@"clearButtonMode"])
  88. {
  89. [output setObject:[OGInstruction initWithString:[value clearButtonModeString]] forKey:item];
  90. }
  91. else
  92. {
  93. [super processKey:item value:value];
  94. }
  95. }
  96. @end