Method: ProMotion::TabBarController#open_tab

Defined in:
lib/ProMotion/cocoatouch/tab_bar_controller.rb

#open_tab(tab) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ProMotion/cocoatouch/tab_bar_controller.rb', line 38

def open_tab(tab)
  if tab.is_a? String
    selected_tab_vc = find_tab(tab)
  elsif tab.is_a? Numeric
    selected_tab_vc = viewControllers[tab]
  end

  unless selected_tab_vc
    mp "Unable to open tab #{tab} -- not found.", force_color: :red
    return
  end

  return unless should_select_tab_try(selected_tab_vc)

  self.selectedViewController = selected_tab_vc
  on_tab_selected_try(selected_tab_vc)

  selected_tab_vc
end