def closest_parent(type, this_view = nil)
      this_view ||= view_or_self.superview
      while this_view != nil do
        return this_view if this_view.is_a? type
        this_view = this_view.superview
      end
      nil
    end
def closest_parent(type, this_view = nil)
      this_view ||= view_or_self.superview
      while this_view != nil do
        return this_view if this_view.is_a? type
        this_view = this_view.superview
      end
      nil
    end
iterate up the view hierarchy to find the parent element
 of "type" containing this view