class UnderOs::UI::Scroll
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
UnderOs::UI::View::new
# File lib/under_os/ui/scroll.rb, line 4 def initialize(options={}) super self.paging = options.delete(:paging) @_.delegate = self end
Public Instance Methods
centerContent()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 53 def centerContent left = @_.contentSize.width > @_.bounds.size.width ? 0 : (@_.bounds.size.width - @_.contentSize.width) * 0.5 top = @_.contentSize.height > @_.bounds.size.height ? 0 : (@_.bounds.size.height - @_.contentSize.height) * 0.5 @_.contentInset = UIEdgeInsetsMake(top, left, top, left) end
contentOffset()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 30 def contentOffset UnderOs::Point.new(x: @_.contentOffset.x, y: @_.contentOffset.y) end
contentOffset=(*args)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 34 def contentOffset=(*args) offset = UnderOs::Point.new(*args) @_.contentOffset = CGPointMake(offset.x, offset.y) end
contentSize()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 21 def contentSize UnderOs::Point.new(x: @_.contentSize.width, y: @_.contentSize.height) end
contentSize=(*args)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 25 def contentSize=(*args) size = UnderOs::Point.new(*args) @_.contentSize = CGSizeMake(size.x, size.y) end
maxScale()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 79 def maxScale @_.maximumZoomScale end
maxScale=(scale)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 83 def maxScale=(scale) @_.maximumZoomScale = scale end
minScale()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 71 def minScale @_.minimumZoomScale end
minScale=(scale)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 75 def minScale=(scale) @_.minimumZoomScale = scale end
paging()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 12 def paging @paging == nil ? false : @paging end
paging=(value)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 16 def paging=(value) @paging = value == true ? true : nil @_.pagingEnabled = paging end
repaint(*args)
click to toggle source
Calls superclass method
UnderOs::UI::Styles#repaint
# File lib/under_os/ui/scroll.rb, line 39 def repaint(*args) content_size = {} super *args do |styles| styles.reject do |key, value| if [:contentWidth, :contentHeight].include?(key) content_size[key] = value end end end self.style = content_size unless content_size.empty? end
scale()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 63 def scale @_.zoomScale end
scale=(scale)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 67 def scale=(scale) @_.zoomScale = scale end
scrollViewDidZoom(scrollView)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 99 def scrollViewDidZoom(scrollView) emit :zoom end
viewForZoomingInScrollView(scrollView)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 95 def viewForZoomingInScrollView(scrollView) @zoomItem end
zoomItem()
click to toggle source
# File lib/under_os/ui/scroll.rb, line 87 def zoomItem @zoomItem end
zoomItem=(item)
click to toggle source
# File lib/under_os/ui/scroll.rb, line 91 def zoomItem=(item) @zoomItem = item.is_a?(UnderOs::UI::View) ? item._ : item end