Sha256: 23b58dd11f730ddda40022669c5591b4da6d85af211268a753e1b15b89c66f19

Contents?: true

Size: 862 Bytes

Versions: 34

Compression:

Stored size: 862 Bytes

Contents

class UIViewController

  def push(view_controller)
    self.addChildViewController(view_controller)
    view_controller.didMoveToParentViewController(self)
    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

34 entries across 34 versions & 1 rubygems

Version Path
sugarcube-0.16.5 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.16.2 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.16 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.15.5 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.15.3 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.15.0 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.14.0 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.13.7 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.13.5 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.13.4 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.13.3 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.13.2 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.13 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.12 lib/sugarcube/uiviewcontroller.rb