前端之家收集整理的这篇文章主要介绍了
Swift学习—Swift中写UI代码,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- //
- // ViewController.swift
- // 02SwiftUI
- //
- // Created by on 15/5/19.
- // Copyright (c) 2015年 wujiafeng. All rights reserved.
- //
-
- import UIKit
-
- class ViewController: UIViewController {
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- var btn = UIButton()
- btn.frame = CGRectMake(100,100,50)
- btn.backgroundColor = UIColor.purpleColor()
- btn.layer.cornerRadius = 10
- self.view.addSubview(btn)
-
- var imageView = UIImageView(image: UIImage(named: "WNM"))
- imageView.frame = CGRectMake(100,250,100)
- self.view.addSubview(imageView)
-
- }
-
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- }
-
-
- }