Class: UnderOs::History

Inherits:
Object
  • Object
show all
Defined in:
lib/under_os/history.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHistory

Returns a new instance of History.



4
5
6
7
# File 'lib/under_os/history.rb', line 4

def initialize
  @_      = UINavigationController.alloc
  @navbar = UnderOs::UI::Navbar.new(@_)
end

Instance Attribute Details

#_Object (readonly)

Returns the value of attribute _.



2
3
4
# File 'lib/under_os/history.rb', line 2

def _
  @_
end

Returns the value of attribute navbar.



2
3
4
# File 'lib/under_os/history.rb', line 2

def navbar
  @navbar
end

Instance Method Details

#current_pageObject



17
18
19
# File 'lib/under_os/history.rb', line 17

def current_page
  @_.visibleViewController.wrapper
end

#pagesObject



39
40
41
# File 'lib/under_os/history.rb', line 39

def pages
  @_.viewControllers.map{|c| c.wrapper rescue nil }.compact
end

#pop(page = nil, animated = true) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/under_os/history.rb', line 31

def pop(page=nil, animated=true)
  if page
    @_.popToViewController(page._, animated: animated)
  else
    @_.popViewControllerAnimated(animated)
  end
end

#pop_to(page, animated = true) ⇒ Object



43
44
45
# File 'lib/under_os/history.rb', line 43

def pop_to(page, animated=true)
  pop(page, animated)
end

#pop_to_root(animated = true) ⇒ Object



47
48
49
# File 'lib/under_os/history.rb', line 47

def pop_to_root(animated=true)
  @_.popToRootViewControllerAnimated(animated)
end

#push(page, animated = true) ⇒ Object Also known as: <<



21
22
23
24
25
26
27
# File 'lib/under_os/history.rb', line 21

def push(page, animated=true)
  if pages.include?(page)
    pop_to(page)
  else
    @_.pushViewController(page._, animated: animated)
  end
end

#root_pageObject



9
10
11
# File 'lib/under_os/history.rb', line 9

def root_page
  @_.topViewController.wrapper
end

#root_page=(page) ⇒ Object



13
14
15
# File 'lib/under_os/history.rb', line 13

def root_page=(page)
  @_.initWithRootViewController(page._)
end