Class: UnderOs::Page
- Inherits:
-
Object
show all
- Includes:
- Events, UI
- Defined in:
- lib/under_os/page.rb
Overview
UOS::Page is kind of a wrap over an iOS controller but instead of the controller, it presents more the main (root) view of the controller in a sence you’ve got for DOM documents in web
Defined Under Namespace
Classes: UIViewControllerWrap
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Page
Returns a new instance of Page.
21
22
23
|
# File 'lib/under_os/page.rb', line 21
def initialize
end
|
Instance Attribute Details
#_ ⇒ Object
Returns the value of attribute _.
11
12
13
|
# File 'lib/under_os/page.rb', line 11
def _
@_
end
|
#stylesheet ⇒ Object
Returns the value of attribute stylesheet.
11
12
13
|
# File 'lib/under_os/page.rb', line 11
def stylesheet
@stylesheet
end
|
Class Method Details
.layout(name = nil) ⇒ Object
17
18
19
|
# File 'lib/under_os/page.rb', line 17
def self.layout(name=nil)
name ? (@layout = name) : @layout
end
|
.new(*args) ⇒ Object
13
14
15
|
# File 'lib/under_os/page.rb', line 13
def self.new(*args)
alloc.setup_wrap(*args)
end
|
Instance Method Details
#alert(*args) ⇒ Object
39
40
41
|
# File 'lib/under_os/page.rb', line 39
def alert(*args)
Alert.new(*args)
end
|
#build_layout ⇒ Object
95
96
97
|
# File 'lib/under_os/page.rb', line 95
def build_layout
@_layout = Layout.new(self)
end
|
#compile_styles ⇒ Object
99
100
101
102
103
|
# File 'lib/under_os/page.rb', line 99
def compile_styles
@stylesheet = Stylesheet.new
@stylesheet << UnderOs::App.stylesheet
@stylesheet.load("#{name}.css")
end
|
#history ⇒ Object
43
44
45
|
# File 'lib/under_os/page.rb', line 43
def history
UnderOs::App.history
end
|
#name ⇒ Object
59
60
61
|
# File 'lib/under_os/page.rb', line 59
def name
self.class.name.underscore.sub(/_page$/, '')
end
|
#navbar ⇒ Object
47
48
49
|
# File 'lib/under_os/page.rb', line 47
def navbar
history.navbar
end
|
#repaint ⇒ Object
105
106
107
108
|
# File 'lib/under_os/page.rb', line 105
def repaint
view.repaint(stylesheet) if view
navbar.repaint(stylesheet) if navbar
end
|
#setup_wrap(*args) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/under_os/page.rb', line 63
def setup_wrap(*args)
@_ = UIViewControllerWrap.alloc.init(self, {
on_load_view: Proc.new{ emit('init') },
on_view_loaded: Proc.new{ emit('load') },
on_view_preappear: Proc.new{ emit('preappear') },
on_view_appear: Proc.new{ emit('appear') },
on_view_disappear: Proc.new{ emit('disappear') },
on_view_rerender: Proc.new{ emit('rerender') },
on_view_rotate: Proc.new{ emit('rotate') }
})
on 'init' do
build_layout
compile_styles
end
on 'load' do
repaint
initialize(*args)
end
on 'preappear' do
repaint
end
on 'rotate' do
repaint
end
self
end
|
#title ⇒ Object
51
52
53
|
# File 'lib/under_os/page.rb', line 51
def title
@_.navigationItem.title
end
|
#title=(text) ⇒ Object
55
56
57
|
# File 'lib/under_os/page.rb', line 55
def title=(text)
@_.navigationItem.title = text
end
|
#view ⇒ Object
25
26
27
|
# File 'lib/under_os/page.rb', line 25
def view
@_view
end
|
#view=(view) ⇒ Object
29
30
31
|
# File 'lib/under_os/page.rb', line 29
def view=(view)
@_view = view
end
|