lib/sugarcube/symbol.rb in sugarcube-0.10 vs lib/sugarcube/symbol.rb in sugarcube-0.11
- old
+ new
@@ -29,10 +29,11 @@
attr_accessor :returnkeys
attr_accessor :statusbar_styles
attr_accessor :barmetrics
attr_accessor :barbuttomitems
attr_accessor :keyboardtypes
+ attr_accessor :autoresizemasks
attr_accessor :textalignments
attr_accessor :linebreakmodes
attr_accessor :baselineadjustments
attr_accessor :system_fonts
@@ -118,10 +119,12 @@
@controlevents = {
touch: UIControlEventTouchUpInside,
touch_up: UIControlEventTouchUpInside,
touch_down: UIControlEventTouchDown,
change: UIControlEventValueChanged|UIControlEventEditingChanged,
+ begin: UIControlEventEditingDidBegin,
+ end: UIControlEventEditingDidEnd,
# I'm leaving this for backwards compatibility. please use 'change' or
# 'editing_did_change':
changed: UIControlEventValueChanged|UIControlEventEditingChanged,
touch_down_repeat: UIControlEventTouchDownRepeat,
@@ -289,10 +292,29 @@
nameandphone: UIKeyboardTypeNamePhonePad,
emailaddress: UIKeyboardTypeEmailAddress,
email: UIKeyboardTypeEmailAddress,
}
+ @autoresizemasks = {
+ none: UIViewAutoresizingNone,
+
+ flexibleleft: UIViewAutoresizingFlexibleLeftMargin,
+ flexiblewidth: UIViewAutoresizingFlexibleWidth,
+ flexibleright: UIViewAutoresizingFlexibleRightMargin,
+ flexibletop: UIViewAutoresizingFlexibleTopMargin,
+ flexibleheight: UIViewAutoresizingFlexibleHeight,
+ flexiblebottom: UIViewAutoresizingFlexibleBottomMargin,
+
+ # aliases
+ left: UIViewAutoresizingFlexibleLeftMargin,
+ width: UIViewAutoresizingFlexibleWidth,
+ right: UIViewAutoresizingFlexibleRightMargin,
+ top: UIViewAutoresizingFlexibleTopMargin,
+ height: UIViewAutoresizingFlexibleHeight,
+ bottom: UIViewAutoresizingFlexibleBottomMargin,
+ }
+
private
def look_in(here)
return here[self] if here.has_key? self
raise SugarNotFoundException.new(self.inspect)
end
@@ -403,9 +425,14 @@
end
def uikeyboardtype
look_in(Symbol.keyboardtypes)
end
+
+ def uiautoresize
+ look_in(Symbol.autoresizemasks)
+ end
+ alias uiviewautoresizing uiautoresize
def uifont(size=UIFont.systemFontSize)
# system fonts
if Symbol.system_fonts.has_key? self
font = look_in(Symbol.system_fonts)