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