Module: ProMotion::DelegateModule

Includes:
SplitScreen, Support, Tabs
Included in:
Delegate
Defined in:
lib/ProMotion/delegate/delegate_module.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Attributes included from Tabs

#tab_bar, #tab_bar_item

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SplitScreen

#create_split_screen, #open_split_screen, #splitViewController

Methods included from Tabs

#create_tab_bar_item, #create_tab_bar_item_custom, #current_tag, #map_tab_symbol, #open_tab, #open_tab_bar, #refresh_tab_bar_item, #replace_current_item, #set_tab_bar_badge, #set_tab_bar_item

Methods included from Support

#app, #app_delegate, #app_window, #try

Instance Attribute Details

#home_screenObject

Returns the value of attribute home_screen.



7
8
9
# File 'lib/ProMotion/delegate/delegate_module.rb', line 7

def home_screen
  @home_screen
end

#windowObject

Returns the value of attribute window.



7
8
9
# File 'lib/ProMotion/delegate/delegate_module.rb', line 7

def window
  @window
end

Class Method Details

.included(base) ⇒ Object



141
142
143
# File 'lib/ProMotion/delegate/delegate_module.rb', line 141

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#application(application, continueUserActivity: user_activity, restorationHandler: restoration_handler) ⇒ Object



9
10
11
12
# File 'lib/ProMotion/delegate/delegate_module.rb', line 9

def application(application, willFinishLaunchingWithOptions:launch_options)
  will_load(application, launch_options) if respond_to?(:will_load)
  true
end

#applicationDidBecomeActive(application) ⇒ Object



21
22
23
# File 'lib/ProMotion/delegate/delegate_module.rb', line 21

def applicationDidBecomeActive(application)
  try :on_activate
end

#applicationDidEnterBackground(application) ⇒ Object



29
30
31
# File 'lib/ProMotion/delegate/delegate_module.rb', line 29

def applicationDidEnterBackground(application)
  try :on_enter_background
end

#applicationWillEnterForeground(application) ⇒ Object



33
34
35
# File 'lib/ProMotion/delegate/delegate_module.rb', line 33

def applicationWillEnterForeground(application)
  try :will_enter_foreground
end

#applicationWillResignActive(application) ⇒ Object



25
26
27
# File 'lib/ProMotion/delegate/delegate_module.rb', line 25

def applicationWillResignActive(application)
  try :will_deactivate
end

#applicationWillTerminate(application) ⇒ Object



37
38
39
# File 'lib/ProMotion/delegate/delegate_module.rb', line 37

def applicationWillTerminate(application)
  try :on_unload
end

#open(screen, args = {}) ⇒ Object Also known as: open_screen



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ProMotion/delegate/delegate_module.rb', line 53

def open(screen, args={})
  screen = set_up_screen_for_open(screen, args)

  self.home_screen = screen

  self.window ||= self.ui_window.alloc.initWithFrame(UIScreen.mainScreen.bounds)
  self.window.rootViewController = (screen.navigationController || screen)
  self.window.tintColor = self.class.send(:get_tint_color) if self.window.respond_to?("tintColor=")
  self.window.makeKeyAndVisible

  screen
end

#set_up_screen_for_open(screen, args = {}) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ProMotion/delegate/delegate_module.rb', line 68

def set_up_screen_for_open(screen, args={})
  # Instantiate screen if given a class
  screen = screen.new(args) if screen.respond_to?(:new)

  # Store screen options
  screen.screen_options.merge(args) if screen.respond_to?(:screen_options)

  # Set title & modal properties
  screen.title = args[:title] if args[:title] && screen.respond_to?(:title=)
  screen.modal = args[:modal] if args[:modal] && screen.respond_to?(:modal=)

  # Hide bottom bar?
  screen.hidesBottomBarWhenPushed = args[:hide_tab_bar] == true

  # Wrap in a PM::NavigationController?
  screen.add_nav_bar(args) if screen.respond_to?(:add_nav_bar)

  # Return modified screen instance
  screen
end

#status_bar?Boolean

DEPRECATED

Returns:

  • (Boolean)


90
91
92
93
# File 'lib/ProMotion/delegate/delegate_module.rb', line 90

def status_bar?
  mp "The default behavior of `status_bar?` has changed. Calling `status_bar?` on AppDelegate may not return the correct result.", force_color: :yellow
  self.class.status_bar_style != :hidden
end

#status_bar_animationObject



99
100
101
# File 'lib/ProMotion/delegate/delegate_module.rb', line 99

def status_bar_animation
  self.class.status_bar_animation
end

#status_bar_styleObject



95
96
97
# File 'lib/ProMotion/delegate/delegate_module.rb', line 95

def status_bar_style
  self.class.status_bar_style
end

#ui_windowObject



49
50
51
# File 'lib/ProMotion/delegate/delegate_module.rb', line 49

def ui_window
  (defined?(Motion) && defined?(Motion::Xray) && defined?(Motion::Xray::XrayWindow)) ? Motion::Xray::XrayWindow : UIWindow
end