mirror of
https://github.com/zhigang1992/rmq.git
synced 2026-01-12 17:52:17 +08:00
@@ -92,6 +92,22 @@ module RubyMotionQuery
|
||||
all: UITextAutocapitalizationTypeAllCharacters
|
||||
}
|
||||
|
||||
CONTENT_MODE_TYPES = {
|
||||
scale_to_fill: UIViewContentModeScaleToFill,
|
||||
scale_aspect_fit: UIViewContentModeScaleAspectFit,
|
||||
scale_aspect_fill: UIViewContentModeScaleAspectFill,
|
||||
redraw: UIViewContentModeRedraw,
|
||||
center: UIViewContentModeCenter,
|
||||
top: UIViewContentModeTop,
|
||||
bottom: UIViewContentModeBottom,
|
||||
left: UIViewContentModeLeft,
|
||||
right: UIViewContentModeRight,
|
||||
top_left: UIViewContentModeTopLeft,
|
||||
top_right: UIViewContentModeTopRight,
|
||||
bottom_left: UIViewContentModeBottomLeft,
|
||||
bottom_right: UIViewContentModeBottomRight
|
||||
}
|
||||
|
||||
# When you create a styler, always inherit UIViewStyler
|
||||
class UIViewStyler
|
||||
def initialize(view)
|
||||
@@ -272,7 +288,7 @@ module RubyMotionQuery
|
||||
end
|
||||
|
||||
def content_mode=(value)
|
||||
@view.setContentMode value
|
||||
@view.setContentMode(CONTENT_MODE_TYPES[value] || value)
|
||||
end
|
||||
def content_mode
|
||||
@view.contentMode
|
||||
|
||||
@@ -57,6 +57,11 @@ class StyleSheetForUIViewStylerTests < RubyMotionQuery::Stylesheet
|
||||
st.shadow_opacity = 0.5
|
||||
st.shadow_path = UIBezierPath.bezierPathWithRect(st.view.bounds).CGPath
|
||||
end
|
||||
|
||||
def ui_view_content_mode_symbol(st)
|
||||
ui_view_kitchen_sink(st)
|
||||
st.content_mode = :center
|
||||
end
|
||||
end
|
||||
|
||||
shared 'styler' do
|
||||
@@ -340,6 +345,11 @@ describe 'ui_view_styler' do
|
||||
view.layer.shadowPath.should == UIBezierPath.bezierPathWithRect(view.bounds).CGPath
|
||||
end
|
||||
|
||||
it "should use symbols for content_mode" do
|
||||
view = @vc.rmq.append(@view_klass, :ui_view_content_mode_symbol).get
|
||||
view.contentMode.should == UIViewContentModeCenter
|
||||
end
|
||||
|
||||
describe "background_gradient" do
|
||||
before do
|
||||
@view = UIView.alloc.init
|
||||
|
||||
Reference in New Issue
Block a user