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