class UnderOs::History

Attributes

_[R]
navbar[R]

Public Class Methods

new() click to toggle source
# File lib/under_os/history.rb, line 4
def initialize
  @_      = UINavigationController.alloc
  @navbar = UnderOs::UI::Navbar.new(@_)
end

Public Instance Methods

<<(page, animated=true)
Alias for: push
current_page() click to toggle source
# File lib/under_os/history.rb, line 17
def current_page
  controller = @_.topViewController

  controller.is_a?(UnderOs::Page::UIViewControllerWrap) ?
    controller.wrapper : root_page
end
pages() click to toggle source
# File lib/under_os/history.rb, line 42
def pages
  @_.viewControllers.map{|c| c.wrapper rescue nil }.compact
end
pop(page=nil, animated=true) click to toggle source
# File lib/under_os/history.rb, line 34
def pop(page=nil, animated=true)
  if page
    @_.popToViewController(page._, animated: animated)
  else
    @_.popViewControllerAnimated(animated)
  end
end
pop_to(page, animated=true) click to toggle source
# File lib/under_os/history.rb, line 46
def pop_to(page, animated=true)
  pop(page, animated)
end
pop_to_root(animated=true) click to toggle source
# File lib/under_os/history.rb, line 50
def pop_to_root(animated=true)
  @_.popToRootViewControllerAnimated(animated)
end
push(page, animated=true) click to toggle source
# File lib/under_os/history.rb, line 24
def push(page, animated=true)
  if pages.include?(page)
    pop_to(page)
  else
    @_.pushViewController(page._, animated: animated)
  end
end
Also aliased as: <<
root_page() click to toggle source
# File lib/under_os/history.rb, line 9
def root_page
  @_.topViewController.wrapper
end
root_page=(page) click to toggle source
# File lib/under_os/history.rb, line 13
def root_page=(page)
  @_.initWithRootViewController(page._)
end