Sha256: 2be4ff563038a9727f6e0c9ce67ee6776b11021d3ce7fe900fd0f68cfcb8358d

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

class UIViewController

  def push(view_controller)
    self.addChildViewController(view_controller)
    self
  end

  # `alias << push` won't work. it doesn't "respect" subclasses overriding the
  # `push` method.
  def <<(view_controller)
    push view_controller
  end

end


class UINavigationController

  def push(view_controller)
    self.pushViewController(view_controller, animated: true)
    self
  end

  def pop(to_view=nil)
    if to_view
      self.popToViewController(to_view, animated: true)
    else
      self.popViewControllerAnimated(true)
    end
  end

end


class UITabBarController

  def push(view_controller)
    view_controllers = [] + self.viewControllers
    view_controllers << view_controller
    self.setViewControllers(view_controllers, animated: true)
    self
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sugarcube-0.11.3 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.11.2 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.11.1 lib/sugarcube/uiviewcontroller.rb