Adds indicator_style for UIScrollView

Tests failing for some reason.
This commit is contained in:
Mark Rickert
2015-02-25 17:09:31 -06:00
parent 52873fa564
commit 72a6f45def
2 changed files with 22 additions and 1 deletions

View File

@@ -1,6 +1,14 @@
module RubyMotionQuery
module Stylers
INDICATOR_STYLES = {
default: UIScrollViewIndicatorStyleDefault,
black: UIScrollViewIndicatorStyleBlack,
dark: UIScrollViewIndicatorStyleBlack,
white: UIScrollViewIndicatorStyleWhite,
light: UIScrollViewIndicatorStyleWhite
}
class UIScrollViewStyler < UIViewStyler
def paging=(value) ; @view.pagingEnabled = value ; end
def paging ; @view.isPagingEnabled ; end
@@ -32,6 +40,8 @@ module RubyMotionQuery
def scroll_indicator_insets=(value); @view.scrollIndicatorInsets = value; end
def scroll_indicator_insets; @view.scrollIndicatorInsets; end
def indicator_style=(value); @view.indicatorStyle = INDICATOR_STYLES[value] || value; end
def indicator_style; @view.indicatorStyle; end
end

View File

@@ -12,6 +12,8 @@ class StyleSheetForUIViewStylerTests < RubyMotionQuery::Stylesheet
st.content_inset = st.content_inset
st.content_inset = UIEdgeInsetsMake(1, 2, 3, 4)
st.indicator_style = UIScrollViewIndicatorStyleDefault
end
# We have to test contentOffset separately from contentInset
@@ -21,6 +23,10 @@ class StyleSheetForUIViewStylerTests < RubyMotionQuery::Stylesheet
st.content_offset = CGPointMake(12, 12)
end
def ui_scroll_view_white_indicators
st.indicator_style = :white
end
end
describe 'stylers/ui_scroll_view' do
@@ -40,13 +46,18 @@ describe 'stylers/ui_scroll_view' do
v.isScrollEnabled.should == false
v.isDirectionalLockEnabled.should == true
v.contentInset.should == UIEdgeInsetsMake(1, 2, 3, 4)
v.indicatorStyle.should == UIScrollViewIndicatorStyleDefault
end
view = @vc.rmq.append(@view_klass, :ui_scroll_view_content_offset).get
view.tap do |v|
v.contentOffset.should == CGPointMake(12, 12)
end
view = @vc.rmq.append(@view_klass, :ui_scroll_view_white_indicators).get
view.tap do |v|
v.indicatorStyle.should == UIScrollViewIndicatorStyleWhite
end
end
end