/
app_delegate.rb
176 lines (172 loc) · 4.48 KB
/
app_delegate.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
class AppDelegate
attr_accessor :view_controller
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
form = Formotion::Form.new({
sections: [{
title: "Register",
rows: [{
title: "Photo",
key: :photo,
type: :image,
image: "camera",
deletable: true
},{
title: "Picker",
key: :pick,
type: :picker,
items: ["Ruby", "Motion", "Rocks"],
value: "Motion"
},{
title: "Email",
key: :email,
placeholder: "me@mail.com",
type: :email,
auto_correction: :no,
auto_capitalization: :none
}, {
title: "Password",
key: :password,
placeholder: "required",
type: :string,
secure: true
}, {
title: "Remote Loaded Image",
type: :static,
image: "http://placekitten.com/80/80?t=#{Time.now.to_i}",
image_placeholder: "camera"
}, {
title: "Password",
subtitle: "Confirmation",
key: :confirm,
placeholder: "required",
type: :string,
secure: true
}, {
title: "Switch",
key: :switch,
type: :switch,
}, {
title: "Bio",
key: :bio,
type: :text,
placeholder: "Enter your Bio here...",
row_height: 100
}, {
title: "Date Full",
value: 326937600,
key: :date_full,
type: :date,
format: :full
}, {
title: "Date Short",
placeholder: "03/26/92",
key: :date_short,
type: :date,
format: :short
}, {
title: "Slider",
key: :slider,
type: :slider
}, {
title: "Account type",
type: :subform,
key: :account,
display_key: :type,
subform: {
title: "Account Type",
sections: [{
key: :type,
select_one: true,
rows: [{
title: "Free",
key: :Free,
type: :check,
}, {
title: "Basic",
value: true,
key: :Basic,
type: :check,
}, {
title: "Pro",
key: :Pro,
type: :check,
}]
}, {
rows: [{
title: "Advanced",
type: :subform,
key: :advanced,
subform: {
title: "Advanced",
sections: [{
key: :currency,
select_one: true,
rows: [{
title: "USD",
value: true,
key: :usd,
type: :check,
}, {
title: "EUR",
key: :eur,
type: :check,
}, {
title: "CHF",
key: :chf,
type: :check,
}]
}, {
rows: [{
title: 'Back',
type: :back
}]
}]
}
}]
}, {
rows: [{
title: 'Back',
type: :back
}]
}]
}
}]
},{
title: 'Your nicknames',
rows: [{
title: "Add nickname",
key: :nicknames,
type: :template,
value: ['Nici', 'Sam'],
template: {
title: 'Nickname',
type: :string,
placeholder: 'Enter here',
indented: true,
deletable: true,
text_alignment: :left
}
}]
}, {
rows: [{
title: "Edit",
alt_title: "Done",
type: :edit,
}]
}, {
rows: [{
title: "Sign Up",
type: :submit,
}]
}]
})
@view_controller = Formotion::FormController.alloc.initWithForm(form)
@view_controller.form.on_submit do |form|
p @view_controller.form.render
end
@window.rootViewController = @view_controller
@window.makeKeyAndVisible
true
end
end