lib/ProMotion/helpers/view_helper.rb in ProMotion-0.7.5 vs lib/ProMotion/helpers/view_helper.rb in ProMotion-0.7.6
- old
+ new
@@ -67,12 +67,12 @@
end
end
height
end
- def closest_parent(type)
+ def closest_parent(type, this_view = nil)
# iterate up the view hierarchy to find the parent element of "type" containing this view
- this_view = self.superview
+ this_view ||= self.superview
while this_view != nil do
return this_view if this_view.is_a? type
this_view = this_view.superview
end
nil