lib/ProMotion/helpers/view_helper.rb in ProMotion-0.7.3 vs lib/ProMotion/helpers/view_helper.rb in ProMotion-0.7.4
- old
+ new
@@ -67,7 +67,16 @@
end
end
height
end
+ def closest_parent(type)
+ # iterate up the view hierarchy to find the parent element of "type" containing this view
+ 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
+ end
end
end