Browse files

change field buffers depending on device

  • Loading branch information...
1 parent 118e266 commit c32ee707193398cb957f6c9289caaab3ac1607e3 @goddamnhippie committed Aug 1, 2012
View
2 lib/formotion/row_type/base.rb
@@ -3,6 +3,8 @@ module RowType
class Base
attr_accessor :row, :tableView
+ FIELD_BUFFER = Device.iphone? ? 20 : 64
+
def tableView
@tableView ||= self.row.form.table
end
View
4 lib/formotion/row_type/button.rb
@@ -18,8 +18,8 @@ def layoutSubviews
((self.frame.size.send(dimen) - frame.size.send(dimen)) / 2.0)
}
- self.textLabel.center = CGPointMake(self.frame.size.width / 2 - 10, self.textLabel.center.y)
- self.detailTextLabel.center = CGPointMake(self.frame.size.width / 2 - 10, self.detailTextLabel.center.y)
+ self.textLabel.center = CGPointMake(self.frame.size.width / 2 - (FIELD_BUFFER / 2), self.textLabel.center.y)
+ self.detailTextLabel.center = CGPointMake(self.frame.size.width / 2 - (FIELD_BUFFER / 2), self.detailTextLabel.center.y)
end
end
nil
View
6 lib/formotion/row_type/image_row.rb
@@ -36,9 +36,9 @@ def layoutSubviews
field_frame = formotion_field.frame
field_frame.origin.y = 10
- field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + 20
- field_frame.size.width = self.frame.size.width - field_frame.origin.x - 20
- field_frame.size.height = self.frame.size.height - 20
+ field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + FIELD_BUFFER
+ field_frame.size.width = self.frame.size.width - field_frame.origin.x - FIELD_BUFFER
+ field_frame.size.height = self.frame.size.height - FIELD_BUFFER
formotion_field.frame = field_frame
end
end
View
6 lib/formotion/row_type/slider_row.rb
@@ -37,9 +37,9 @@ def layoutSubviews
field_frame = formotion_field.frame
field_frame.origin.y = 10
- field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + 20
- field_frame.size.width = self.frame.size.width - field_frame.origin.x - 20
- field_frame.size.height = self.frame.size.height - 20
+ field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + FIELD_BUFFER
+ field_frame.size.width = self.frame.size.width - field_frame.origin.x - FIELD_BUFFER
+ field_frame.size.height = self.frame.size.height - FIELD_BUFFER
formotion_field.frame = field_frame
end
end
View
4 lib/formotion/row_type/string_row.rb
@@ -51,9 +51,9 @@ def layoutSubviews
formotion_field.sizeToFit
field_frame = formotion_field.frame
- field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + 20
+ field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + FIELD_BUFFER
field_frame.origin.y = ((self.frame.size.height - field_frame.size.height) / 2.0).round
- field_frame.size.width = self.frame.size.width - field_frame.origin.x - 20
+ field_frame.size.width = self.frame.size.width - field_frame.origin.x - FIELD_BUFFER
formotion_field.frame = field_frame
end
end
View
6 lib/formotion/row_type/text_row.rb
@@ -60,9 +60,9 @@ def layoutSubviews
field_frame = formotion_field.frame
field_frame.origin.y = 10
- field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + 20
- field_frame.size.width = self.frame.size.width - field_frame.origin.x - 20
- field_frame.size.height = self.frame.size.height - 20
+ field_frame.origin.x = self.textLabel.frame.origin.x + self.textLabel.frame.size.width + FIELD_BUFFER
+ field_frame.size.width = self.frame.size.width - field_frame.origin.x - FIELD_BUFFER
+ field_frame.size.height = self.frame.size.height - FIELD_BUFFER
formotion_field.frame = field_frame
end
end

0 comments on commit c32ee70

Please sign in to comment.