Class: RMXAutoLayoutScrollView

Inherits:
UIScrollView
  • Object
show all
Defined in:
lib/motion/RMXAutoLayoutScrollView.rb

Defined Under Namespace

Classes: FittedView, FollowView

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#contentViewObject

Returns the value of attribute contentView.



18
19
20
# File 'lib/motion/RMXAutoLayoutScrollView.rb', line 18

def contentView
  @contentView
end

Class Method Details

.fitted_to(parent) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/motion/RMXAutoLayoutScrollView.rb', line 19

def self.fitted_to(parent)
  followView = FollowView.new
  followView.userInteractionEnabled = false
  followView.hidden = true
  fittedView = FittedView.new
  fittedView.backgroundColor = UIColor.clearColor
  fittedView.followView = followView
  followView.fittedView = fittedView
  # add a subview to parent called followView
  RMX::Layout.new do |layout|
    layout.view parent
    layout.subviews "x" => followView
    layout.eqs %Q{
      x.top == 0
      x.right == 0
      x.bottom == 0
      x.left == 0
    }
  end
  x = new
  x.contentView = fittedView
  # add a subview to scrollView called contentView
  RMX::Layout.new do |layout|
    layout.view x
    layout.subviews "x" => fittedView
    layout.eqs %Q{
      x.top == 0
      x.right == 0
      x.bottom == 0
      x.left == 0
    }
  end
  x
end