Module: ProMotion::ScreenModule
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
#add_nav_bar, #nav_bar?, #navigationController=, #navigation_controller, #navigation_controller=, #set_nav_bar_button, #set_nav_bar_left_button, #set_toolbar_items
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
#app, #app_delegate, #close_screen, #open_in_split_screen, #open_modal, #open_root_screen, #open_screen, #push_view_controller, #send_on_return
Instance Attribute Details
#first_screen ⇒ Object
Returns the value of attribute first_screen.
9
10
11
|
# File 'lib/ProMotion/screen/screen_module.rb', line 9
def first_screen
@first_screen
end
|
#modal ⇒ Object
Returns the value of attribute modal.
9
10
11
|
# File 'lib/ProMotion/screen/screen_module.rb', line 9
def modal
@modal
end
|
#parent_screen ⇒ Object
Returns the value of attribute parent_screen.
9
10
11
|
# File 'lib/ProMotion/screen/screen_module.rb', line 9
def parent_screen
@parent_screen
end
|
#split_screen ⇒ Object
Returns the value of attribute split_screen.
9
10
11
|
# File 'lib/ProMotion/screen/screen_module.rb', line 9
def split_screen
@split_screen
end
|
Instance Method Details
#bounds ⇒ Object
161
162
163
|
# File 'lib/ProMotion/screen/screen_module.rb', line 161
def bounds
return self.view_or_self.bounds
end
|
#first_screen? ⇒ Boolean
61
62
63
|
# File 'lib/ProMotion/screen/screen_module.rb', line 61
def first_screen?
self.first_screen == true
end
|
#frame ⇒ Object
165
166
167
|
# File 'lib/ProMotion/screen/screen_module.rb', line 165
def frame
return self.view_or_self.frame
end
|
#modal? ⇒ Boolean
22
23
24
|
# File 'lib/ProMotion/screen/screen_module.rb', line 22
def modal?
self.modal == true
end
|
#on_appear ⇒ Object
83
|
# File 'lib/ProMotion/screen/screen_module.rb', line 83
def on_appear; end
|
#on_disappear ⇒ Object
99
|
# File 'lib/ProMotion/screen/screen_module.rb', line 99
def on_disappear; end
|
#on_dismiss ⇒ Object
100
|
# File 'lib/ProMotion/screen/screen_module.rb', line 100
def on_dismiss; end
|
#on_present ⇒ Object
84
|
# File 'lib/ProMotion/screen/screen_module.rb', line 84
def on_present; end
|
#on_rotate ⇒ Object
124
125
|
# File 'lib/ProMotion/screen/screen_module.rb', line 124
def on_rotate
end
|
#resolve_status_bar ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/ProMotion/screen/screen_module.rb', line 36
def resolve_status_bar
case self.class.status_bar_type
when :none
status_bar_hidden true
when :light
status_bar_hidden false
status_bar_style UIStatusBarStyleLightContent
else
status_bar_hidden false
status_bar_style UIStatusBarStyleDefault
end
end
|
#resolve_title ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/ProMotion/screen/screen_module.rb', line 26
def resolve_title
case self.class.title_type
when :text then self.title = self.class.title
when :view then self.navigationItem.titleView = self.class.title
when :image then self.navigationItem.titleView = UIImageView.alloc.initWithImage(self.class.title)
else
PM.logger.warn("title expects string, UIView, or UIImage, but #{self.class.title.class.to_s} given.")
end
end
|
#screen_init(args = {}) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/ProMotion/screen/screen_module.rb', line 11
def screen_init(args = {})
check_ancestry
resolve_title
apply_properties(args)
add_nav_bar(args) if args[:nav_bar]
tab_bar_setup
try :screen_setup
try :on_init
PM.logger.deprecated "In #{self.class.to_s}, #on_create has been deprecated and removed. Use #screen_init instead." if respond_to?(:on_create)
end
|
#should_autorotate ⇒ Object
120
121
122
|
# File 'lib/ProMotion/screen/screen_module.rb', line 120
def should_autorotate
true
end
|
#should_rotate(orientation) ⇒ Object
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/ProMotion/screen/screen_module.rb', line 102
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
|
#status_bar_hidden(hidden) ⇒ Object
49
50
51
|
# File 'lib/ProMotion/screen/screen_module.rb', line 49
def status_bar_hidden(hidden)
UIApplication.sharedApplication.setStatusBarHidden(hidden, withAnimation:self.class.status_bar_animation)
end
|
#status_bar_style(style) ⇒ Object
53
54
55
|
# File 'lib/ProMotion/screen/screen_module.rb', line 53
def status_bar_style(style)
UIApplication.sharedApplication.setStatusBarStyle(style)
end
|
#supported_device_families ⇒ Object
148
149
150
151
152
153
154
155
|
# File 'lib/ProMotion/screen/screen_module.rb', line 148
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
157
158
159
|
# File 'lib/ProMotion/screen/screen_module.rb', line 157
def supported_device_family?(family)
supported_device_families.include?(family)
end
|
#supported_orientation?(orientation) ⇒ Boolean
144
145
146
|
# File 'lib/ProMotion/screen/screen_module.rb', line 144
def supported_orientation?(orientation)
NSBundle.mainBundle.infoDictionary["UISupportedInterfaceOrientations"].include?(orientation)
end
|
#supported_orientations ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/ProMotion/screen/screen_module.rb', line 127
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
|
#try(method, *args) ⇒ Object
169
170
171
|
# File 'lib/ProMotion/screen/screen_module.rb', line 169
def try(method, *args)
send(method, *args) if respond_to?(method)
end
|
#view_did_appear(animated) ⇒ Object
78
79
80
81
82
|
# File 'lib/ProMotion/screen/screen_module.rb', line 78
def view_did_appear(animated)
self.on_appear
self.on_present if isMovingToParentViewController
end
|
#view_did_disappear(animated) ⇒ Object
94
95
96
97
98
|
# File 'lib/ProMotion/screen/screen_module.rb', line 94
def view_did_disappear(animated)
self.on_disappear
self.on_dismiss if isMovingFromParentViewController
end
|
#view_did_load ⇒ Object
65
66
67
|
# File 'lib/ProMotion/screen/screen_module.rb', line 65
def view_did_load
self.send(:on_load) if self.respond_to?(:on_load)
end
|
#view_will_appear(animated) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/ProMotion/screen/screen_module.rb', line 69
def view_will_appear(animated)
resolve_status_bar
self.will_appear
self.will_present if isMovingToParentViewController
end
|
#view_will_disappear(animated) ⇒ Object
86
87
88
89
90
|
# File 'lib/ProMotion/screen/screen_module.rb', line 86
def view_will_disappear(animated)
self.will_disappear
self.will_dismiss if isMovingFromParentViewController
end
|
#will_appear ⇒ Object
75
|
# File 'lib/ProMotion/screen/screen_module.rb', line 75
def will_appear; end
|
#will_disappear ⇒ Object
91
|
# File 'lib/ProMotion/screen/screen_module.rb', line 91
def will_disappear; end
|
#will_dismiss ⇒ Object
92
|
# File 'lib/ProMotion/screen/screen_module.rb', line 92
def will_dismiss; end
|
#will_present ⇒ Object
76
|
# File 'lib/ProMotion/screen/screen_module.rb', line 76
def will_present; end
|
#will_rotate(orientation, duration) ⇒ Object
117
118
|
# File 'lib/ProMotion/screen/screen_module.rb', line 117
def will_rotate(orientation, duration)
end
|