mirror of
https://github.com/zhigang1992/rmq.git
synced 2026-01-12 17:52:17 +08:00
Adds indicator_style for UIScrollView
Tests failing for some reason.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user