Class: UnderOs::History
- Inherits:
-
Object
- Object
- UnderOs::History
- Defined in:
- lib/under_os/history.rb
Instance Attribute Summary collapse
-
#_ ⇒ Object
readonly
Returns the value of attribute _.
-
#navbar ⇒ Object
readonly
Returns the value of attribute navbar.
Instance Method Summary collapse
- #current_page ⇒ Object
-
#initialize ⇒ History
constructor
A new instance of History.
- #pages ⇒ Object
- #pop(page = nil, animated = true) ⇒ Object
- #pop_to(page, animated = true) ⇒ Object
- #pop_to_root(animated = true) ⇒ Object
- #push(page, animated = true) ⇒ Object (also: #<<)
- #root_page ⇒ Object
- #root_page=(page) ⇒ Object
Constructor Details
Instance Attribute Details
#_ ⇒ Object (readonly)
Returns the value of attribute _.
2 3 4 |
# File 'lib/under_os/history.rb', line 2 def _ @_ end |
#navbar ⇒ Object (readonly)
Returns the value of attribute navbar.
2 3 4 |
# File 'lib/under_os/history.rb', line 2 def @navbar end |
Instance Method Details
#current_page ⇒ Object
17 18 19 |
# File 'lib/under_os/history.rb', line 17 def current_page @_.visibleViewController.wrapper end |
#pages ⇒ Object
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_page ⇒ Object
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 |