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, #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_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
139
140
141
|
# File 'lib/ProMotion/screen/screen_module.rb', line 139
def bounds
return self.view_or_self.bounds
end
|
#first_screen? ⇒ Boolean
40
41
42
|
# File 'lib/ProMotion/screen/screen_module.rb', line 40
def first_screen?
self.first_screen == true
end
|
#frame ⇒ Object
143
144
145
|
# File 'lib/ProMotion/screen/screen_module.rb', line 143
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
61
|
# File 'lib/ProMotion/screen/screen_module.rb', line 61
def on_appear; end
|
#on_disappear ⇒ Object
77
|
# File 'lib/ProMotion/screen/screen_module.rb', line 77
def on_disappear; end
|
#on_dismiss ⇒ Object
78
|
# File 'lib/ProMotion/screen/screen_module.rb', line 78
def on_dismiss; end
|
#on_present ⇒ Object
62
|
# File 'lib/ProMotion/screen/screen_module.rb', line 62
def on_present; end
|
#on_rotate ⇒ Object
102
103
|
# File 'lib/ProMotion/screen/screen_module.rb', line 102
def on_rotate
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
tab_bar_setup
set_attributes self, args
add_nav_bar(args) if args[:nav_bar]
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
98
99
100
|
# File 'lib/ProMotion/screen/screen_module.rb', line 98
def should_autorotate
true
end
|
#should_rotate(orientation) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/ProMotion/screen/screen_module.rb', line 80
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
126
127
128
129
130
131
132
133
|
# File 'lib/ProMotion/screen/screen_module.rb', line 126
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
135
136
137
|
# File 'lib/ProMotion/screen/screen_module.rb', line 135
def supported_device_family?(family)
supported_device_families.include?(family)
end
|
#supported_orientation?(orientation) ⇒ Boolean
122
123
124
|
# File 'lib/ProMotion/screen/screen_module.rb', line 122
def supported_orientation?(orientation)
NSBundle.mainBundle.infoDictionary["UISupportedInterfaceOrientations"].include?(orientation)
end
|
#supported_orientations ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/ProMotion/screen/screen_module.rb', line 105
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
56
57
58
59
60
|
# File 'lib/ProMotion/screen/screen_module.rb', line 56
def view_did_appear(animated)
self.on_appear
self.on_present if isMovingToParentViewController
end
|
#view_did_disappear(animated) ⇒ Object
72
73
74
75
76
|
# File 'lib/ProMotion/screen/screen_module.rb', line 72
def view_did_disappear(animated)
self.on_disappear
self.on_dismiss if isMovingFromParentViewController
end
|
#view_did_load ⇒ Object
44
45
46
|
# File 'lib/ProMotion/screen/screen_module.rb', line 44
def view_did_load
self.send(:on_load) if self.respond_to?(:on_load)
end
|
#view_will_appear(animated) ⇒ Object
48
49
50
51
52
|
# File 'lib/ProMotion/screen/screen_module.rb', line 48
def view_will_appear(animated)
self.will_appear
self.will_present if isMovingToParentViewController
end
|
#view_will_disappear(animated) ⇒ Object
64
65
66
67
68
|
# File 'lib/ProMotion/screen/screen_module.rb', line 64
def view_will_disappear(animated)
self.will_disappear
self.will_dismiss if isMovingFromParentViewController
end
|
#will_appear ⇒ Object
53
|
# File 'lib/ProMotion/screen/screen_module.rb', line 53
def will_appear; end
|
#will_disappear ⇒ Object
69
|
# File 'lib/ProMotion/screen/screen_module.rb', line 69
def will_disappear; end
|
#will_dismiss ⇒ Object
70
|
# File 'lib/ProMotion/screen/screen_module.rb', line 70
def will_dismiss; end
|
#will_present ⇒ Object
54
|
# File 'lib/ProMotion/screen/screen_module.rb', line 54
def will_present; end
|
#will_rotate(orientation, duration) ⇒ Object
95
96
|
# File 'lib/ProMotion/screen/screen_module.rb', line 95
def will_rotate(orientation, duration)
end
|