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
#initialize ⇒ History
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 |
#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 20 21 22 |
# 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 ⇒ Object
42 43 44 |
# File 'lib/under_os/history.rb', line 42 def pages @_.viewControllers.map{|c| c.wrapper rescue nil }.compact end |
#pop(page = nil, animated = true) ⇒ Object
34 35 36 37 38 39 40 |
# 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) ⇒ Object
46 47 48 |
# File 'lib/under_os/history.rb', line 46 def pop_to(page, animated=true) pop(page, animated) end |
#pop_to_root(animated = true) ⇒ Object
50 51 52 |
# File 'lib/under_os/history.rb', line 50 def pop_to_root(animated=true) @_.popToRootViewControllerAnimated(animated) end |
#push(page, animated = true) ⇒ Object Also known as: <<
24 25 26 27 28 29 30 |
# 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 |
#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 |