質問編集履歴

2

コード

2016/06/02 23:02

投稿

TheLastSoldier
TheLastSoldier

スコア16

test CHANGED
File without changes
test CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
 
4
4
 
5
+ import UIKit
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
5
17
  class ViewController: UIViewController {
6
18
 
7
19
 
@@ -16,9 +28,7 @@
16
28
 
17
29
  }
18
30
 
19
-
20
-
21
-
31
+
22
32
 
23
33
  func Calculation() {
24
34
 
@@ -52,13 +62,153 @@
52
62
 
53
63
  backView.addSubview(label0)
54
64
 
65
+
66
+
67
+ let label1 = UIButton() //1
68
+
69
+ label1.frame = CGRectMake(1, 272, 124, 124)
70
+
71
+ label1.backgroundColor = UIColor.redColor()
72
+
73
+ label1.setTitle("1", forState: .Normal)
74
+
75
+ label1.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
76
+
77
+ label1.titleLabel!.font = UIFont.systemFontOfSize(29)
78
+
55
-
79
+ label1.tag = 1
80
+
56
-
81
+ backView.addSubview(label1)
82
+
83
+
84
+
85
+ let label2 = UIButton() //2
86
+
87
+ label2.frame = CGRectMake(126, 272, 124, 124)
88
+
89
+ label2.backgroundColor = UIColor.redColor()
90
+
91
+ label2.setTitle("2", forState: .Normal)
92
+
93
+ label2.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
94
+
95
+ label2.titleLabel!.font = UIFont.systemFontOfSize(29)
96
+
57
-
97
+ label2.tag = 2
98
+
58
-
99
+ backView.addSubview(label2)
100
+
101
+
102
+
103
+ let label3 = UIButton() //3
104
+
105
+ label3.frame = CGRectMake(251,272, 124, 124)
106
+
107
+ label3.backgroundColor = UIColor.redColor()
108
+
109
+ label3.setTitle("3", forState: .Normal)
110
+
111
+ label3.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
112
+
113
+ label3.titleLabel!.font = UIFont.systemFontOfSize(29)
114
+
59
-
115
+ label3.tag = 3
116
+
60
-
117
+ backView.addSubview(label3)
118
+
119
+
120
+
121
+
122
+
123
+ let label4 = UIButton() //4
124
+
125
+ label4.frame = CGRectMake( 1, 397, 124, 124)
126
+
127
+ label4.backgroundColor = UIColor.blackColor()
128
+
129
+ label4.setTitle("4", forState: .Normal)
130
+
131
+ label4.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
132
+
133
+ label4.titleLabel!.font = UIFont.systemFontOfSize(29)
134
+
61
-
135
+ label4.tag = 4
136
+
137
+ backView.addSubview(label4)
138
+
139
+
140
+
141
+ let label5 = UIButton() //5
142
+
143
+ label5.frame = CGRectMake(126,397, 124, 124)
144
+
145
+ label5.backgroundColor = UIColor.blackColor()
146
+
147
+ label5.setTitle("5", forState: .Normal)
148
+
149
+ label5.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
150
+
151
+ label5.titleLabel!.font = UIFont.systemFontOfSize(29)
152
+
153
+ label5.tag = 5
154
+
155
+ backView.addSubview(label5)
156
+
157
+
158
+
159
+ let label6 = UIButton() //6
160
+
161
+ label6.frame = CGRectMake(251, 397, 124, 124)
162
+
163
+ label6.backgroundColor = UIColor.blackColor()
164
+
165
+ label6.setTitle("6", forState: .Normal)
166
+
167
+ label6.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
168
+
169
+ label6.titleLabel!.font = UIFont.systemFontOfSize(29)
170
+
171
+ label6.tag = 6
172
+
173
+ backView.addSubview(label6)
174
+
175
+
176
+
177
+ let label7 = UIButton() //7
178
+
179
+ label7.frame = CGRectMake(1, 522, 124, 124)
180
+
181
+ label7.backgroundColor = UIColor.blueColor()
182
+
183
+ label7.setTitle("7", forState: .Normal)
184
+
185
+ label7.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
186
+
187
+ label7.titleLabel!.font = UIFont.systemFontOfSize(29)
188
+
189
+ label7.tag = 7
190
+
191
+ backView.addSubview(label7)
192
+
193
+
194
+
195
+ let label8 = UIButton() //8
196
+
197
+ label8.frame = CGRectMake(126, 522, 124, 124)
198
+
199
+ label8.backgroundColor = UIColor.blueColor()
200
+
201
+ label8.setTitle("8", forState: .Normal)
202
+
203
+ label8.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
204
+
205
+ label8.titleLabel!.font = UIFont.systemFontOfSize(29)
206
+
207
+ label6.tag = 8
208
+
209
+ backView.addSubview(label8)
210
+
211
+
62
212
 
63
213
  let label9 = UIButton() //9
64
214
 
@@ -76,7 +226,111 @@
76
226
 
77
227
  backView.addSubview(label9)
78
228
 
229
+
230
+
79
-
231
+ //足し算
232
+
233
+ let labelplus = UIButton()
234
+
235
+ labelplus.frame = CGRect(x: 10, y: 10, width: 40, height: 40)
236
+
237
+ labelplus.backgroundColor = UIColor.blackColor()
238
+
239
+ labelplus.setTitle("+", forState: .Normal)
240
+
241
+ labelplus.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
242
+
243
+ labelplus.titleLabel!.font = UIFont.systemFontOfSize(29)
244
+
245
+ labelplus.tag = 01
246
+
247
+ backView.addSubview(labelplus)
248
+
249
+
250
+
251
+ let labelminus = UIButton() //引き算
252
+
253
+ labelminus.frame = CGRect(x: 60, y: 10, width: 40, height: 40)
254
+
255
+ labelminus.backgroundColor = UIColor.blackColor()
256
+
257
+ labelminus.setTitle("-", forState: .Normal)
258
+
259
+ labelminus.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
260
+
261
+ labelminus.titleLabel!.font = UIFont.systemFontOfSize(29)
262
+
263
+ labelminus.tag = 02
264
+
265
+ backView.addSubview(labelminus)
266
+
267
+
268
+
269
+ let labelproduct = UIButton() //掛け算
270
+
271
+ labelproduct.frame = CGRect(x: 110, y: 10, width: 40, height: 40)
272
+
273
+ labelproduct.backgroundColor = UIColor.blackColor()
274
+
275
+ labelproduct.setTitle("x", forState: .Normal)
276
+
277
+ labelproduct.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
278
+
279
+ labelproduct.titleLabel!.font = UIFont.systemFontOfSize(29)
280
+
281
+ labelproduct.tag = 03
282
+
283
+ backView.addSubview(labelproduct)
284
+
285
+
286
+
287
+ let labelquontient = UIButton() //割り算
288
+
289
+ labelquontient.frame = CGRect(x: 180, y: 10, width: 40, height: 40)
290
+
291
+ labelquontient.backgroundColor = UIColor.blackColor()
292
+
293
+ labelquontient.setTitle("/", forState: .Normal)
294
+
295
+ labelquontient.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
296
+
297
+ labelquontient.titleLabel!.font = UIFont.systemFontOfSize(29)
298
+
299
+ labelquontient.tag = 04
300
+
301
+ backView.addSubview(labelquontient)
302
+
303
+
304
+
305
+ let labelclear = UIButton() //現在の計算結果を0にリセット
306
+
307
+ labelclear.frame = CGRect(x: 280, y: 10, width: 40, height: 40)
308
+
309
+ labelclear.backgroundColor = UIColor.blackColor()
310
+
311
+ labelclear.setTitle("C", forState: .Normal)
312
+
313
+ labelclear.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Normal)
314
+
315
+ labelclear.titleLabel!.font = UIFont.systemFontOfSize(29)
316
+
317
+ labelclear.tag = 05
318
+
319
+ backView.addSubview(labelclear)
320
+
321
+
322
+
323
+ let labelresult = UILabel() //計算結果を表示させる
324
+
325
+ labelresult.frame = CGRect(x: 1, y: 60, width: 370, height: 210)
326
+
327
+ labelresult.backgroundColor = UIColor.lightGrayColor()
328
+
329
+ backView.addSubview(labelresult)
330
+
331
+
332
+
333
+
80
334
 
81
335
  func num(sender:UIButton){
82
336
 
@@ -92,10 +346,14 @@
92
346
 
93
347
  }
94
348
 
95
- } // Thread 1 : breakpoint1.1 ここです
349
+ } //ここです
96
350
 
97
351
 
98
352
 
353
+
354
+
355
+
356
+
99
357
  override func didReceiveMemoryWarning() {
100
358
 
101
359
  super.didReceiveMemoryWarning()
@@ -112,4 +370,6 @@
112
370
 
113
371
 
114
372
 
373
+
374
+
115
375
  しかし、iPhone 6s でシミュレーターを起動してみると、エディタ画面に戻ってしまい、Thread 1 :breakpoint1.1というエラーが出てしまいます。control + command + y をしてみましたが、処理が実行されません。何が原因なのか全くわかりません。どうかご回答よろしくお願いしますm(_)m

1

エラー名

2016/06/02 23:02

投稿

TheLastSoldier
TheLastSoldier

スコア16

test CHANGED
File without changes
test CHANGED
@@ -92,7 +92,7 @@
92
92
 
93
93
  }
94
94
 
95
- } // Thread 1 : breakpoint1.1
95
+ } // Thread 1 : breakpoint1.1 ここです
96
96
 
97
97
 
98
98
 
@@ -112,4 +112,4 @@
112
112
 
113
113
 
114
114
 
115
- しかし、iPhone 6s でシミュレーターを起動してみると、エディタ画面に戻ってしまい、上のよエラーが出てしまいます。control + command + y をしてみましたが、処理が実行されません。何が原因なのか全くわかりません。どうかご回答よろしくお願いしますm(_)m
115
+ しかし、iPhone 6s でシミュレーターを起動してみると、エディタ画面に戻ってしまい、Thread 1 :breakpoint1.1というエラーが出てしまいます。control + command + y をしてみましたが、処理が実行されません。何が原因なのか全くわかりません。どうかご回答よろしくお願いしますm(_)m