UIBezierPath 彩虹旗 HW04–1
Published in
4 min readJul 24, 2020
上課時程式拆開講都聽得懂,但實際操作時就很慌張...因為要上班的緣故,可以練習的時間很少,原本以為畫個旗子很簡單,但最後還是求助彼得了orz
import UIKitvar typoImg = UIImage(named: "f12.png")let typoImageView = UIImageView(image: typoImg)typoImageView.frame = CGRect(x: 90, y: 50, width: 332, height: 219)var flagBody = CGRect(x: 0, y: 0, width: 500, height: 360)let flagBodyView = UIView(frame: flagBody)flagBodyView.backgroundColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1)flagBody = CGRect(x:(flagBodyView.frame.width - 100)/2, y:(flagBodyView.frame.height - 100)/2, width:500, height:360)var flagOrange = CGRect(x: 0, y: 60, width: 500, height: 60)let flagOrangeView = UIView(frame: flagOrange)flagOrangeView.backgroundColor = UIColor(red: 1, green: 0.5, blue: 0, alpha: 1)var flagYellow = CGRect(x: 0, y: 120, width: 500, height: 60)let flagYellowView = UIView(frame: flagYellow)flagYellowView.backgroundColor = UIColor(red: 1, green: 1, blue: 0, alpha: 1)var flagGreen = CGRect(x: 0, y: 180, width: 500, height: 60)let flagGreenView = UIView(frame: flagGreen)flagGreenView.backgroundColor = UIColor(red: 0, green: 0.8, blue: 0, alpha: 1)var flagBlue = CGRect(x: 0, y: 240, width: 500, height: 60)let flagBlueView = UIView(frame: flagBlue)flagBlueView.backgroundColor = UIColor(red: 0, green: 0.3, blue: 0.7, alpha: 1)var flagPuprle = CGRect(x: 0, y: 300, width: 500, height: 60)let flagPuprleView = UIView(frame: flagPuprle)flagPuprleView.backgroundColor = UIColor(red: 0.3, green: 0.1, blue: 0.4, alpha: 1)flagBodyView.addSubview(flagPuprleView)flagBodyView.addSubview(flagOrangeView)flagBodyView.addSubview(flagYellowView)flagBodyView.addSubview(flagGreenView)flagBodyView.addSubview(flagBlueView)flagBodyView.addSubview(typoImageView)
試著在腦中用圖像的方式形成邏輯,因為想順便訓練使用Ipad Pro作為輔助紀錄用的工具,大概試了5.6種wireframe.phototype的APP,似乎還未找到適合我能快速順手紀錄的,最後先用Procreate快速紀錄一下