Class: RMXView
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
included
#dealloc, #description, #inspect
Instance Attribute Details
#reportSizeChanges ⇒ Object
Returns the value of attribute reportSizeChanges.
6
7
8
|
# File 'lib/motion/RMXView.rb', line 6
def reportSizeChanges
@reportSizeChanges
end
|
#updatedSize ⇒ Object
Returns the value of attribute updatedSize.
6
7
8
|
# File 'lib/motion/RMXView.rb', line 6
def updatedSize
@updatedSize
end
|
Class Method Details
.create(attributes = {}) ⇒ Object
31
32
33
34
35
|
# File 'lib/motion/RMXView.rb', line 31
def self.create(attributes={})
x = new
x.attributes = attributes
x
end
|
Instance Method Details
#hitTest(point, withEvent: event) ⇒ Object
normal userInteractionEnabled means the view and all subviews can’t be clicked. what we normally want is subviews to be clickable, but not the parent. this custom hitTest allows that behavior.
39
40
41
42
43
44
45
|
# File 'lib/motion/RMXView.rb', line 39
def hitTest(point, withEvent:event)
s = super
if s == self && @userInteractionEnabled == false
return nil
end
s
end
|
#init ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/motion/RMXView.rb', line 19
def init
s = super
prepare
setUserInteractionEnabled(false)
setup
s
end
|
#layoutSubviews ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/motion/RMXView.rb', line 51
def layoutSubviews
s = super
if reportSizeChanges
Dispatch::Queue.main.async do
size = systemLayoutSizeFittingSize(UILayoutFittingCompressedSize)
unless updatedSize == size
self.updatedSize = size
RMX.new(self).trigger(:updatedSize, size)
if tableView = is_or_within_a?(UITableView)
if tableView.delegate.respondsToSelector('tableView:viewDidUpdateSize:')
tableView.delegate.tableView(tableView, viewDidUpdateSize:self)
end
RMX.new(self).debounce(:reloadTableUpdatedSize) do
if controller = tableView.lAncestorViewController
if controller.viewState == :viewDidAppear
tableView.beginUpdates
tableView.endUpdates
else
tableView.reloadData
end
end
end
end
end
end
end
s
end
|
#prepare ⇒ Object
13
14
|
# File 'lib/motion/RMXView.rb', line 13
def prepare
end
|
#requiresConstraintBasedLayout ⇒ Object
47
48
49
|
# File 'lib/motion/RMXView.rb', line 47
def requiresConstraintBasedLayout
true
end
|
#rmx_dealloc ⇒ Object
8
9
10
11
|
# File 'lib/motion/RMXView.rb', line 8
def rmx_dealloc
NSNotificationCenter.defaultCenter.removeObserver(self)
super
end
|
#setup ⇒ Object
16
17
|
# File 'lib/motion/RMXView.rb', line 16
def setup
end
|
#setUserInteractionEnabled(bool) ⇒ Object
27
28
29
|
# File 'lib/motion/RMXView.rb', line 27
def setUserInteractionEnabled(bool)
@userInteractionEnabled = bool
end
|