基本題:

使用丹麥國旗作為這次的練習

import UIKitlet Denmarkrect = CGRect(x: 0, y: 0, width: 350, height: 200)let DenmarkrectView = UIView(frame: Denmarkrect)DenmarkrectView.backgroundColor = UIColor(red: 204/255, green: 0, blue: 51/255, alpha: 1)let rectwhite1 = CGRect(x: 0, y: 75, width: 350, height: 50)let rectwhite1View = UIView(frame: rectwhite1)rectwhite1View.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)DenmarkrectView.addSubview(rectwhite1View)let rectwhite2 = CGRect(x: 90, y: 0, width: 50, height: 200)let rectwhite2View = UIView(frame: rectwhite2)rectwhite2View.backgroundColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)DenmarkrectView.addSubview(rectwhite2View)

--

--

--

--

學習使用 API 製作圖表

圓餅圖 Pie Chart

addWedge(withProportion:color:) :設定顏色

addKeyItem(withLabel: color:) :設定顏色對應到的品項

長條圖 Bar Chart

setYAxis(minimum:maximum:) :設立縱軸的範圍

addBar(withLength:color:):設定顏色

addBarLabel(_:) :設定顏色對應到的品項

--

--