Sha256: 3a7b9ab23b09ddf50d62e128bdf158649d0ed8b4d5f856cdf642f62408f2504b

Contents?: true

Size: 843 Bytes

Versions: 3

Compression:

Stored size: 843 Bytes

Contents

class UnderOs::UI::Scroll < UnderOs::UI::View
  wraps UIScrollView, tag: :scroll

  def initialize(options={})
    super

    self.paging = options.delete(:paging)
  end

  def paging
    @paging == nil ? false : @paging
  end

  def paging=(value)
    @paging = value == true ? true : nil
    @_.pagingEnabled = paging
  end

  def contentSize
    UnderOs::Point.new(x: @_.contentSize.width, y: @_.contentSize.height)
  end

  def contentSize=(*args)
    size = UnderOs::Point.new(*args)
    @_.contentSize = CGSizeMake(size.x, size.y)
  end

  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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
under-os-1.3.0 lib/under_os/ui/scroll.rb
under-os-1.2.1 lib/under_os/ui/scroll.rb
under-os-1.2.0 lib/under_os/ui/scroll.rb