#58 Swift 的九九乘法 App

目的: 學習 for 迴圈

1 在 playground 用 print 印出結果

結果如下:

1 * 1 = 11 * 2 = 21 * 3 = 31 * 4 = 41 * 5 = 51 * 6 = 61 * 7 = 71 * 8 = 81 * 9 = 92 * 1 = 22 * 2 = 42 * 3 = 62 * 4 = 82 * 5 = 102 * 6 = 122 * 7 = 142 * 8 = 162 * 9 = 183 * 1 = 33 * 2 = 63 * 3 = 93 * 4 = 123 * 5 = 153 * 6 = 183 * 7 = 213 * 8 = 243 * 9 = 274 * 1 = 44 * 2 = 84 * 3 = 124 * 4 = 164 * 5 = 204 * 6 = 244 * 7 = 284 * 8 = 324 * 9 = 365 * 1 = 55 * 2 = 105 * 3 = 155 * 4 = 205 * 5 = 255 * 6 = 305 * 7 = 355 * 8 = 405 * 9 = 456 * 1 = 66 * 2 = 126 * 3 = 186 * 4 = 246 * 5 = 306 * 6 = 366 * 7 = 426 * 8 = 486 * 9 = 547 * 1 = 77 * 2 = 147 * 3 = 217 * 4 = 287 * 5 = 357 * 6 = 427 * 7 = 497 * 8 = 567 * 9 = 638 * 1 = 88 * 2 = 168 * 3 = 248 * 4 = 328 * 5 = 408 * 6 = 488 * 7 = 568 * 8 = 648 * 9 = 729 * 1 = 99 * 2 = 189 * 3 = 279 * 4 = 369 * 5 = 459 * 6 = 549 * 7 = 639 * 8 = 729 * 9 = 81

2 製作九九乘法表畫面

(1) 製作以下的九九乘法表畫面。

(2) 製作以下的九九乘法表畫面。

(3) 模仿以下畫面,某些 label 顯示特別的顏色 。第一排和第一列的 label 文字粗體。

提示

label 文字置中

label.textAlignment = .center

文字粗體範例

正常

UIFont.systemFont(ofSize: 14)

粗體

UIFont.boldSystemFont(ofSize: 14)

(4) 加上 slider 控制數量

3 九九乘法測驗

搭配亂數出題。

參考範例

彼得潘的 100 道 Swift iOS App 謎題

適合新手練功的 100 道 Swift iOS App 謎題

彼得潘的 iOS App Neverland

Written by

彼得潘的 Swift 程式設計入門,App程式設計入門作者,彼得潘的iOS App程式設計入門,文組生的iOS App程式設計入門講師,http://apppeterpan.strikingly.com

彼得潘的 100 道 Swift iOS App 謎題

適合新手練功的 100 道 Swift iOS App 謎題

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade