Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.73 KB | None | 0 0
  1. import UIKit
  2.  
  3. class ViewController: UIViewController {
  4.  
  5.     override func viewWillAppear(_ animated: Bool) {
  6.         super.viewWillAppear(true)
  7.        
  8.         view.backgroundColor = UIColor.gray
  9.        
  10.         let width = 50
  11.         let height = 50
  12.        
  13.         for whiteValue in 0...7 {
  14.            
  15.        
  16.        
  17.         let size = CGSize(width: width, height: height)
  18.        
  19.         let origin = CGPoint(x: whiteValue * width, y: 100 + height * whiteValue  )
  20.            
  21.         let frame = CGRect(origin: origin, size: size)
  22.            
  23.            
  24.         let viewWhite = UIView(frame: frame)
  25.        
  26.         viewWhite.backgroundColor = UIColor.white
  27.        
  28.         view.addSubview(viewWhite)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement