Module: ProMotion::ScreenModule
- Includes:
- NavBarModule, ScreenNavigation, SplitScreen, StatusBarModule, Styling, Support, Tabs
- Included in:
- CollectionScreen, GroupedTableScreen, Screen, TableScreen, WebScreen
- Defined in:
- lib/ProMotion/screen/screen_module.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
Attributes included from Tabs
#tab_bar, #tab_bar_item
Instance Method Summary
collapse
#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
#hide_status_bar, #preferredStatusBarStyle, #preferredStatusBarUpdateAnimation, #prefersStatusBarHidden, #show_status_bar, #update_status_bar_appearance
#add_nav_bar, #nav_bar?, #navigationController=, #navigation_controller, #navigation_controller=, #set_nav_bar_button, #set_nav_bar_buttons, #set_toolbar_items, #update_nav_bar_visibility
Methods included from Styling
#add, #add_to, #camelize, #closest_parent, #content_height, #content_max, #content_width, #hex_color, #remove, #rgb_color, #rgba_color, #set_attribute, #set_attributes, #view_or_self
#close_screen, #open_in_split_screen, #open_modal, #open_root_screen, #open_screen, #push_view_controller, #replace_nav_stack, #send_on_return
Methods included from Support
#app, #app_delegate, #app_window, #try
Instance Attribute Details
#first_screen ⇒ Object
Returns the value of attribute first_screen.
12
13
14
|
# File 'lib/ProMotion/screen/screen_module.rb', line 12
def first_screen
@first_screen
end
|
#modal ⇒ Object
Returns the value of attribute modal.
12
13
14
|
# File 'lib/ProMotion/screen/screen_module.rb', line 12
def modal
@modal
end
|
#parent_screen ⇒ Object
Returns the value of attribute parent_screen.
11
12
13
|
# File 'lib/ProMotion/screen/screen_module.rb', line 11
def parent_screen
@parent_screen
end
|
#screen_options ⇒ Object
Returns the value of attribute screen_options.
12
13
14
|
# File 'lib/ProMotion/screen/screen_module.rb', line 12
def screen_options
@screen_options
end
|
#split_screen ⇒ Object
Returns the value of attribute split_screen.
12
13
14
|
# File 'lib/ProMotion/screen/screen_module.rb', line 12
def split_screen
@split_screen
end
|
Instance Method Details
#add_child_screen(screen) ⇒ Object
151
152
153
154
155
156
157
|
# File 'lib/ProMotion/screen/screen_module.rb', line 151
def add_child_screen(screen)
screen = screen.new if screen.respond_to?(:new)
addChildViewController(screen)
screen.parent_screen = self
screen.didMoveToParentViewController(self)
screen
end
|
#bounds ⇒ Object
143
144
145
|
# File 'lib/ProMotion/screen/screen_module.rb', line 143
def bounds
return self.view_or_self.bounds
end
|
#did_receive_memory_warning ⇒ Object
77
78
79
|
# File 'lib/ProMotion/screen/screen_module.rb', line 77
def did_receive_memory_warning
self.on_memory_warning
end
|
#first_screen? ⇒ Boolean
35
36
37
|
# File 'lib/ProMotion/screen/screen_module.rb', line 35
def first_screen?
self.first_screen == true
end
|
#frame ⇒ Object
147
148
149
|
# File 'lib/ProMotion/screen/screen_module.rb', line 147
def frame
return self.view_or_self.frame
end
|
#modal? ⇒ Boolean
27
28
29
|
# File 'lib/ProMotion/screen/screen_module.rb', line 27
def modal?
self.modal == true
end
|
#on_appear ⇒ Object
58
|
# File 'lib/ProMotion/screen/screen_module.rb', line 58
def on_appear; end
|
#on_disappear ⇒ Object
74
|
# File 'lib/ProMotion/screen/screen_module.rb', line 74
def on_disappear; end
|
#on_dismiss ⇒ Object
75
|
# File 'lib/ProMotion/screen/screen_module.rb', line 75
def on_dismiss; end
|
#on_memory_warning ⇒ Object
80
81
82
|
# File 'lib/ProMotion/screen/screen_module.rb', line 80
def on_memory_warning
mp "Received memory warning in #{self.inspect}. You should implement on_memory_warning in your screen.", force_color: :red
end
|
#on_present ⇒ Object
59
|
# File 'lib/ProMotion/screen/screen_module.rb', line 59
def on_present; end
|
#on_rotate ⇒ Object
106
107
|
# File 'lib/ProMotion/screen/screen_module.rb', line 106
def on_rotate
end
|
#remove_child_screen(screen) ⇒ Object
159
160
161
162
163
164
|
# File 'lib/ProMotion/screen/screen_module.rb', line 159
def remove_child_screen(screen)
screen.parent_screen = nil
screen.willMoveToParentViewController(nil)
screen.removeFromParentViewController
screen
end
|
#screen_init(args = {}) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/ProMotion/screen/screen_module.rb', line 14
def screen_init(args = {})
@screen_options = args
check_ancestry
resolve_title
apply_properties(args)
add_nav_bar(args)
add_nav_bar_buttons
tab_bar_setup
try :on_init
try :screen_setup
mp "In #{self.class.to_s}, #on_create has been deprecated and removed. Use #screen_init instead.", force_color: :yellow if respond_to?(:on_create)
end
|
#should_autorotate ⇒ Object
102
103
104
|
# File 'lib/ProMotion/screen/screen_module.rb', line 102
def should_autorotate
true
end
|
#should_rotate(orientation) ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/ProMotion/screen/screen_module.rb', line 84
def should_rotate(orientation)
case orientation
when UIInterfaceOrientationPortrait
return supported_orientation?("UIInterfaceOrientationPortrait")
when UIInterfaceOrientationLandscapeLeft
return supported_orientation?("UIInterfaceOrientationLandscapeLeft")
when UIInterfaceOrientationLandscapeRight
return supported_orientation?("UIInterfaceOrientationLandscapeRight")
when UIInterfaceOrientationPortraitUpsideDown
return supported_orientation?("UIInterfaceOrientationPortraitUpsideDown")
else
false
end
end
|
#supported_device_families ⇒ Object
130
131
132
133
134
135
136
137
|
# File 'lib/ProMotion/screen/screen_module.rb', line 130
def supported_device_families
NSBundle.mainBundle.infoDictionary["UIDeviceFamily"].map do |m|
{
"1" => :iphone,
"2" => :ipad
}[m] || :unknown_device
end
end
|
#supported_device_family?(family) ⇒ Boolean
139
140
141
|
# File 'lib/ProMotion/screen/screen_module.rb', line 139
def supported_device_family?(family)
supported_device_families.include?(family)
end
|
#supported_orientation?(orientation) ⇒ Boolean
126
127
128
|
# File 'lib/ProMotion/screen/screen_module.rb', line 126
def supported_orientation?(orientation)
NSBundle.mainBundle.infoDictionary["UISupportedInterfaceOrientations"].include?(orientation)
end
|
#supported_orientations ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/ProMotion/screen/screen_module.rb', line 109
def supported_orientations
orientations = 0
NSBundle.mainBundle.infoDictionary["UISupportedInterfaceOrientations"].each do |ori|
case ori
when "UIInterfaceOrientationPortrait"
orientations |= UIInterfaceOrientationMaskPortrait
when "UIInterfaceOrientationLandscapeLeft"
orientations |= UIInterfaceOrientationMaskLandscapeLeft
when "UIInterfaceOrientationLandscapeRight"
orientations |= UIInterfaceOrientationMaskLandscapeRight
when "UIInterfaceOrientationPortraitUpsideDown"
orientations |= UIInterfaceOrientationMaskPortraitUpsideDown
end
end
orientations
end
|
#view_did_appear(animated) ⇒ Object
53
54
55
56
57
|
# File 'lib/ProMotion/screen/screen_module.rb', line 53
def view_did_appear(animated)
self.on_appear
self.on_present if isMovingToParentViewController
end
|
#view_did_disappear(animated) ⇒ Object
69
70
71
72
73
|
# File 'lib/ProMotion/screen/screen_module.rb', line 69
def view_did_disappear(animated)
self.on_disappear
self.on_dismiss if isMovingFromParentViewController
end
|
#view_did_load ⇒ Object
39
40
41
|
# File 'lib/ProMotion/screen/screen_module.rb', line 39
def view_did_load
self.send(:on_load) if self.respond_to?(:on_load)
end
|
#view_will_appear(animated) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/ProMotion/screen/screen_module.rb', line 43
def view_will_appear(animated)
update_nav_bar_visibility(animated)
self.will_appear
self.will_present if isMovingToParentViewController
end
|
#view_will_disappear(animated) ⇒ Object
61
62
63
64
65
|
# File 'lib/ProMotion/screen/screen_module.rb', line 61
def view_will_disappear(animated)
self.will_disappear
self.will_dismiss if isMovingFromParentViewController
end
|
#will_appear ⇒ Object
50
|
# File 'lib/ProMotion/screen/screen_module.rb', line 50
def will_appear; end
|
#will_disappear ⇒ Object
66
|
# File 'lib/ProMotion/screen/screen_module.rb', line 66
def will_disappear; end
|
#will_dismiss ⇒ Object
67
|
# File 'lib/ProMotion/screen/screen_module.rb', line 67
def will_dismiss; end
|
#will_present ⇒ Object
51
|
# File 'lib/ProMotion/screen/screen_module.rb', line 51
def will_present; end
|
#will_rotate(orientation, duration) ⇒ Object
99
100
|
# File 'lib/ProMotion/screen/screen_module.rb', line 99
def will_rotate(orientation, duration)
end
|