Files
freeCodeCamp/guide/chinese/swift/view-controller/index.md
2018-10-16 21:32:40 +05:30

16 lines
464 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: View Controllers
localeTitle: 查看控制器
---
## 查看控制器
这是Swift中基本视图的示例。
\`\`\`斯威夫特 导入UIKit
class ViewControllerUIViewController { // 1 override func viewDidLoad{ // 2 super.viewDidLoad // 3 view.backgroundColor = .white }
} \`\`\`
1. 控制器加载后加载视图。
2. 覆盖UIViewController类。这是任何视图控制器的必要步骤。
3. 将背景颜色设置为白色。