Permalink
Browse files

text_alignment property

  • Loading branch information...
1 parent 94ce49b commit df2b50f6ff5e0c66c03e4f65a8b52437e5481ce2 @clayallsopp committed Dec 17, 2012
Showing with 17 additions and 3 deletions.
  1. +4 −0 CHANGELOG.md
  2. +2 −1 app/app_delegate.rb
  3. +10 −1 lib/formotion/row/row.rb
  4. +1 −1 lib/formotion/row_type/string_row.rb
View
@@ -1,7 +1,11 @@
## 1.2 - ??
+### Features
+
- Added `:picker_mode` row property which lets you choose what type of date picker you're using (i.e. `:date`, `:time`, `:date_time`, or `:countdown`)
+- Added `:text_alignment` row property which controls how a row's input field's text is aligned (i.e. `:right` (default), `:left`, or `:center`).
+
### Bug Fixes
- Fixed size issue with iPhone apps running @2x on an iPad (see `row_type/base.rb#field_buffer`)
View
@@ -140,7 +140,8 @@ def application(application, didFinishLaunchingWithOptions:launchOptions)
type: :string,
placeholder: 'Enter here',
indented: true,
- deletable: true
+ deletable: true,
+ text_alignment: :left
}
}]
}, {
@@ -25,6 +25,10 @@ class Row < Formotion::Base
# The following apply only to text-input fields
+ # text alignment of the input field
+ # OPTIONS: :left, :right, :center
+ # DEFAULT is :right
+ :text_alignment,
# placeholder text
:placeholder,
# whether or not the entry field is secure (like a password)
@@ -222,6 +226,10 @@ def clear_button=(value)
@clear_button = const_int_get("UITextFieldViewMode", value)
end
+ def text_alignment=(alignment)
+ @text_alignment = const_int_get("UITextAlignment", alignment)
+ end
+
#########################
# setters for callbacks
@@ -309,7 +317,8 @@ def load_constants_hack
UIReturnKeyYahoo, UIReturnKeyDone, UIReturnKeyEmergencyCall,
UITextFieldViewModeNever, UITextFieldViewModeAlways, UITextFieldViewModeWhileEditing,
UITextFieldViewModeUnlessEditing, NSDateFormatterShortStyle, NSDateFormatterMediumStyle,
- NSDateFormatterLongStyle, NSDateFormatterFullStyle
+ NSDateFormatterLongStyle, NSDateFormatterFullStyle,
+ UITextAlignmentRight, UITextAlignmentCenter, UITextAlignmentLeft
]
end
end
@@ -30,7 +30,7 @@ def build_cell(cell)
field.clearButtonMode = UITextFieldViewModeWhileEditing
field.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter
- field.textAlignment = UITextAlignmentRight
+ field.textAlignment = row.text_alignment || UITextAlignmentRight
field.keyboardType = keyboardType

0 comments on commit df2b50f

Please sign in to comment.