From 866dfe7af6e8cf8f149fff75cb2bd832f8c3f157 Mon Sep 17 00:00:00 2001 From: Gant Date: Fri, 13 Mar 2015 12:19:01 -0500 Subject: [PATCH] all tests green - set background image for tableviews --- .../stylers/ui_table_view_styler.rb | 11 +++++++++++ spec/stylers/ui_table_view_styler.rb | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/motion/ruby_motion_query/stylers/ui_table_view_styler.rb b/motion/ruby_motion_query/stylers/ui_table_view_styler.rb index 57f02fd..e0be729 100644 --- a/motion/ruby_motion_query/stylers/ui_table_view_styler.rb +++ b/motion/ruby_motion_query/stylers/ui_table_view_styler.rb @@ -22,6 +22,17 @@ module RubyMotionQuery @view.rowHeight = value end + def background_image=(value) + @view.backgroundView = UIImageView.alloc.initWithImage(value) + end + def background_image + if @view.backgroundView + @view.backgroundView.image + else + nil + end + end + SEPARATOR_STYLES = { none: UITableViewCellSeparatorStyleNone, single: UITableViewCellSeparatorStyleSingleLine, diff --git a/spec/stylers/ui_table_view_styler.rb b/spec/stylers/ui_table_view_styler.rb index cfcd2b7..c84e1d9 100644 --- a/spec/stylers/ui_table_view_styler.rb +++ b/spec/stylers/ui_table_view_styler.rb @@ -36,4 +36,16 @@ describe 'stylers/ui_table_view' do v.rowHeight.should == 20 end end + + it 'should allow getting and setting the background image' do + + view = @vc.rmq.append(@view_klass, :ui_table_view_kitchen_sink) + + view.style do |st| + st.background_image.should == nil + background = rmq.image.resource("Default") + st.background_image = background + st.background_image.should == background + end + end end