Swift学习—Swift中写UI代码

前端之家收集整理的这篇文章主要介绍了Swift学习—Swift中写UI代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. //
  2. // ViewController.swift
  3. // 02SwiftUI
  4. //
  5. // Created by on 15/5/19.
  6. // Copyright (c) 2015年 wujiafeng. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10.  
  11. class ViewController: UIViewController {
  12.  
  13. override func viewDidLoad() {
  14. super.viewDidLoad()
  15. var btn = UIButton()
  16. btn.frame = CGRectMake(100,100,50)
  17. btn.backgroundColor = UIColor.purpleColor()
  18. btn.layer.cornerRadius = 10
  19. self.view.addSubview(btn)
  20. var imageView = UIImageView(image: UIImage(named: "WNM"))
  21. imageView.frame = CGRectMake(100,250,100)
  22. self.view.addSubview(imageView)
  23. }
  24.  
  25. override func didReceiveMemoryWarning() {
  26. super.didReceiveMemoryWarning()
  27. }
  28.  
  29.  
  30. }

猜你在找的Swift相关文章