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.18.21 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.20 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.19 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.18 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.17 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.16 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.12 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.11 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.10 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.9 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.8 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.7 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.6 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.5 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.4 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.3 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.2 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.1 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.18.0 lib/sugarcube/uiviewcontroller.rb
sugarcube-0.16.9 lib/sugarcube/uiviewcontroller.rb