<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by estie821 on Medium]]></title>
        <description><![CDATA[Stories by estie821 on Medium]]></description>
        <link>https://medium.com/@estie821?source=rss-9d9f84d34e06------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*NakBW2IAN-N8XxVfGgJoUQ.png</url>
            <title>Stories by estie821 on Medium</title>
            <link>https://medium.com/@estie821?source=rss-9d9f84d34e06------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 02:49:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@estie821/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[選擇題app-電影通考驗 ]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E9%81%B8%E6%93%87%E9%A1%8Capp-%E9%9B%BB%E5%BD%B1%E9%80%9A%E8%80%83%E9%A9%97-7db9e4afc0de?source=rss-9d9f84d34e06------2</link>
            <guid isPermaLink="false">https://medium.com/p/7db9e4afc0de</guid>
            <dc:creator><![CDATA[estie821]]></dc:creator>
            <pubDate>Mon, 08 Jun 2020 16:22:55 GMT</pubDate>
            <atom:updated>2020-06-09T08:59:28.017Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*TzvhavQ2tAlvVYZpIjOTJA.png" /></figure><p>選擇題app，參考了好多同學的做法，謝謝：）</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstreamable.com%2Fo%2F8i2g1t&amp;display_name=Streamable&amp;url=https%3A%2F%2Fstreamable.com%2F8i2g1t&amp;image=https%3A%2F%2Fcdn-b-east.streamable.com%2Fimage%2F8i2g1t_1.jpg%3Ftoken%3DZamiG_0NLlXmUSPkFPBqKQ%26expires%3D1591639320&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=streamable" width="342" height="718" frameborder="0" scrolling="no"><a href="https://medium.com/media/21fe2105849b7b9140a5bebb03a7002f/href">https://medium.com/media/21fe2105849b7b9140a5bebb03a7002f/href</a></iframe><p>程式碼</p><pre>import UIKit</pre><pre>class ViewController: UIViewController {</pre><pre>@IBOutlet weak var movieImage: UIImageView!</pre><pre>@IBOutlet weak var imageSizeSlider: UILabel!</pre><pre>@IBOutlet weak var questionLabel: UILabel!</pre><pre>@IBOutlet var optionButton: [UIButton]!</pre><pre>@IBOutlet var correctImage: [UIImageView]!</pre><pre>@IBOutlet weak var scoreLabel: UILabel!</pre><pre>var questionData = [Question(description: &quot;本電影片名是？&quot;, answer: &quot;活個痛快&quot;, imageName: &quot;50-50-icon&quot;, option: [&quot;五十之五十&quot;,&quot;五十件事&quot;,&quot;活個痛快&quot;]),</pre><pre>Question(description: &quot;本電影劇中女主角叫？&quot;, answer: &quot;艾蜜莉&quot;, imageName: &quot;Amelie-icon&quot;, option: [&quot;愛美麗&quot;,&quot;艾米粒&quot;,&quot;艾蜜莉&quot;]),</pre><pre>Question(description: &quot;本電影男主從事之運動？&quot;, answer: &quot;高爾夫&quot;, imageName: &quot;Arthur-Newman-icon&quot;, option: [&quot;高爾夫&quot;,&quot;游泳&quot;,&quot;棒球&quot;]),</pre><pre>Question(description: &quot;本電影背景時間發生於&quot;, answer: &quot;1861&quot;, imageName: &quot;Gone-with-the-Wind-icon&quot;, option:[&quot;1911&quot;,&quot;1861&quot;,&quot;1951&quot;]),</pre><pre>Question(description: &quot;本電影在imdb上之分數&quot;, answer: &quot;6&quot;, imageName: &quot;Hide-and-Seek-icon&quot;, option: [&quot;5&quot;,&quot;6&quot;,&quot;7&quot;]),</pre><pre>Question(description: &quot;本電影中文片名是？&quot;, answer: &quot;人人有份&quot;, imageName: &quot;In-the-Loop-icon&quot;, option: [&quot;迴圈之中&quot;,&quot;人人有份&quot;,&quot;身在環中&quot;]),</pre><pre>Question(description: &quot;本電影主角是何動物？&quot;, answer: &quot;熊貓&quot;, imageName: &quot;Kung-Fu-Panda-Holiday-icon&quot;, option: [&quot;貓熊&quot;,&quot;狸貓&quot;,&quot;熊貓&quot;]),</pre><pre>Question(description: &quot;本電影用什麼發電？&quot;, answer: &quot;用叫發電&quot;, imageName: &quot;Monsters-University-icon&quot;, option: [&quot;用愛發電&quot;,&quot;用笑發電&quot;,&quot;用叫發電&quot;]),</pre><pre>Question(description: &quot;本電影主角遇見了誰？&quot;, answer: &quot;蘇格拉底&quot;, imageName: &quot;Peaceful-Warrior-icon&quot;, option: [&quot;蘇格拉底&quot;,&quot;柏拉圖&quot;,&quot;亞里士多德&quot;]),</pre><pre>Question(description: &quot;本電影劇中離別禮物？&quot;, answer: &quot;音樂盒&quot;, imageName: &quot;Seven-Years-in-Tibet-icon&quot;, option: [&quot;音樂盒&quot;,&quot;巧克力一盒&quot;,&quot;珠寶盒&quot;]),</pre><pre>Question(description: &quot;本電影中文片名是？&quot;, answer: &quot;福祿雙霸天&quot;, imageName: &quot;The-Blues-Brothers-icon&quot;, option: [&quot;藍調兄弟&quot;,&quot;福祿雙霸天&quot;,&quot;天才靈魂樂手&quot;]),</pre><pre>Question(description: &quot;本電影電影發生地點？&quot;, answer: &quot;紐約&quot;, imageName: &quot;The-Nanny-Diaries-icon&quot;, option: [&quot;舊金山&quot;,&quot;紐約&quot;,&quot;波士頓&quot;])]</pre><pre>var index = 0</pre><pre>var score = 0</pre><pre>var rightAnswer = &quot;&quot;</pre><pre>override func viewDidLoad() {</pre><pre>super.viewDidLoad()</pre><pre>// Do any additional setup after loading the view.</pre><pre>//顯示題目圖片部分：設定畫面一開始時電影圖片的大小與位置，若slider畫面一開始時停在50%，則要去計算圖片寬高*0.5等，去計算呈現的大小與xy位置</pre><pre>movieImage.frame = CGRect(x: 119, y: 120, width: 176, height: 155)</pre><pre>//下面電影選擇題部分</pre><pre>questionData.shuffle()</pre><pre>scoreLabel.text = &quot;\(score)&quot;</pre><pre>playGame()</pre><pre>}</pre><pre><br>//建個playgame方法,選擇題運作方法</pre><pre>func playGame(){</pre><pre>questionLabel.text = questionData[index].description</pre><pre>rightAnswer = questionData[index].answer</pre><pre>movieImage.image = UIImage(named:questionData[index].imageName)</pre><pre>questionData[index].option.shuffle()</pre><pre>for i in 0...2{</pre><pre>optionButton[i].setTitle(questionData[index].option[i], for: UIControl.State.normal)</pre><pre>}</pre><pre>}</pre><pre>//滑動slider改變電影圖片大小(放大縮小)</pre><pre>@IBAction func sliderImagesize(_ sender: UISlider) {</pre><pre>//label(叫imageSizeSlider)會顯示slider滑動的數值</pre><pre>imageSizeSlider.text = &quot;\(Int(sender.value*10))%&quot;</pre><pre>//宣告一個常數imageSize，當作Slider的sender.value，sender.value為float，要轉為CGFloat</pre><pre>let imageSize = CGFloat(sender.value)</pre><pre>//宣告movieImage長寬的變數（因為設為每次以10％縮放可縮放十次，原圖大小為350*310，故起始的縮放大小應為原始圖十分之一，35*31）</pre><pre>let imgWidth:CGFloat = 35</pre><pre>let imgHeight:CGFloat = 31</pre><pre>/*使用CGAffineTransform會縮放到超出頁面</pre><pre>movieImage.transform = CGAffineTransform(scaleX: imageSize, y: imageSize)*/</pre><pre>/* movieImage.frame.size.width = imgWidth * imageSize，用frame會以左上角為原點縮放，用boounds會以中心點為縮放*/</pre><pre>movieImage.bounds.size.width = imgWidth * imageSize</pre><pre>movieImage.bounds.size.height = imgHeight * imageSize</pre><pre>//上面兩行也可以寫成一行 movieImage.bounds = CGRect(x: 0, y: 0, width: imgWidth*imageSize, height: imgWidth*imageSize)</pre><pre>}</pre><pre>@IBAction func chooseAnswerBtn(_ sender: UIButton) {</pre><pre>      let selectAnswer = sender.titleLabel?.text</pre><pre>      var correctNumber = -1</pre><pre>      var isCorrect = false</pre><pre>      for button in optionButton{</pre><pre>      //鎖定答案，按鈕不能再按了，button狀態改為不能點選</pre><pre>      button.isEnabled = false </pre><pre>           if button.titleLabel!.text == rightAnswer{</pre><pre>           correctNumber = button.tag<br>           }</pre><pre>       }</pre><pre>     if selectAnswer == rightAnswer {</pre><pre>        isCorrect = true</pre><pre>        score += 10</pre><pre>        scoreLabel.text = &quot;\(score)&quot;</pre><pre>      }</pre><pre>     for correctImage in correctImage{</pre><pre>          if correctImage.tag == correctNumber{</pre><pre>          correctImage.image = UIImage(named: &quot;playstation-circle-   icon&quot;)</pre><pre>           }</pre><pre>          if correctImage.tag == sender.tag{</pre><pre>               if !isCorrect {</pre><pre>               correctImage.image = UIImage(named: &quot;playstation-cross-icon&quot;)</pre><pre>                }</pre><pre>            }</pre><pre>      }</pre><pre>}</pre><pre>@IBAction func nextButton(_ sender: UIButton) {</pre><pre>//清空correctImage,按鈕恢復</pre><pre>for button in optionButton{</pre><pre>button.isEnabled = true</pre><pre>}</pre><pre>for correctImage in correctImage{</pre><pre>correctImage.image = UIImage(named: &quot;&quot;)</pre><pre>}</pre><pre>if index == questionData.count - 1{</pre><pre>let finalGameAlert = UIAlertController(title: &quot;遊戲結束&quot;, message: &quot;總計\(score)/120分&quot;, preferredStyle: .alert)</pre><pre>let okActionButton = UIAlertAction(title: &quot;知道了&quot;, style: .default, handler: nil)</pre><pre>finalGameAlert.addAction(okActionButton)</pre><pre>present(finalGameAlert, animated: true, completion: nil)</pre><pre>}</pre><pre>if index &lt; questionData.count - 1 {</pre><pre>index = index + 1</pre><pre>playGame()</pre><pre>}</pre><pre>}</pre><pre>@IBAction func allReplayBtn(_ sender: UIButton) {</pre><pre>//清空correctImage,按鈕恢復</pre><pre>for button in optionButton{</pre><pre>button.isEnabled = true</pre><pre>}</pre><pre>for correctImage in correctImage{</pre><pre>correctImage.image = UIImage(named: &quot;&quot;)</pre><pre>}</pre><pre>score = 0</pre><pre>scoreLabel.text = &quot;\(score)&quot;</pre><pre>index = 0</pre><pre>questionData.shuffle()</pre><pre>playGame()</pre><pre>}</pre><pre>}<br></pre><p>參考資料：</p><ul><li><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/%E9%81%B8%E6%93%87%E9%A1%8C-app-9e130504fc72">選擇題 App</a></li><li><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/25-%E9%81%B8%E6%93%87%E9%A1%8C-app-46e50f99210d">#25 選擇題 App</a></li><li><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/%E9%81%B8%E6%93%87%E9%A1%8Capp-%E7%8C%9C%E7%87%88%E8%AC%8E-2c52f647d6a3">選擇題APP-猜燈謎</a></li></ul><p>還有好多彼得潘#25選擇題app下的作品集分享～非常值得每個都點開來閱讀！收穫滿滿～感謝大家。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7db9e4afc0de" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E9%81%B8%E6%93%87%E9%A1%8Capp-%E9%9B%BB%E5%BD%B1%E9%80%9A%E8%80%83%E9%A9%97-7db9e4afc0de">選擇題app-電影通考驗 🎥</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[單向非即時的基本匯率app ]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E5%96%AE%E5%90%91%E9%9D%9E%E5%8D%B3%E6%99%82%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%8C%AF%E7%8E%87app-3663bc48d7b8?source=rss-9d9f84d34e06------2</link>
            <guid isPermaLink="false">https://medium.com/p/3663bc48d7b8</guid>
            <dc:creator><![CDATA[estie821]]></dc:creator>
            <pubDate>Fri, 22 May 2020 16:02:16 GMT</pubDate>
            <atom:updated>2020-05-22T16:06:29.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*WqomhPbB-jDYToP1VJ5PDA.png" /></figure><p>👀操作畫面：</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstreamable.com%2Fo%2Fc6q6n3&amp;display_name=Streamable&amp;url=https%3A%2F%2Fstreamable.com%2Fc6q6n3&amp;image=https%3A%2F%2Fcdn-b-east.streamable.com%2Fimage%2Fc6q6n3.jpg%3Ftoken%3DAPUk0LY_Xr3y76lT-xQKYQ%26expires%3D1590170100&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=streamable" width="523" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/57587be6f0c5082b89e7d141f15b1ebb/href">https://medium.com/media/57587be6f0c5082b89e7d141f15b1ebb/href</a></iframe><p>✏️程式碼：</p><pre>import UIKit</pre><pre>class ViewController: UIViewController {</pre><pre>@IBOutlet weak var moneySegCtrl: UISegmentedControl!</pre><pre>@IBOutlet weak var photoSwitch: UISwitch!</pre><pre>@IBOutlet weak var moneyLabel: UILabel!</pre><pre>@IBOutlet weak var MoneyInput: UITextField!</pre><pre>@IBOutlet weak var moneyOutput: UITextField!</pre><pre>override func viewDidLoad() {</pre><pre>super.viewDidLoad()</pre><pre>// Do any additional setup after loading the view.</pre><pre>//調整segmentedControl字型</pre><pre>moneySegCtrl.setTitleTextAttributes([.font: UIFont(name: &quot;Nagurigaki-Crayon&quot;, size: 22)], for: .normal)</pre><pre>}</pre><pre>//UIswitch，segment上的文字變圖案<br></pre><pre>@IBAction func switchPhote(_ sender: UISwitch) {</pre><pre>if (sender.isOn == false) {</pre><pre>moneySegCtrl.setImage(UIImage(named: &quot;US.png&quot;), forSegmentAt: 0)</pre><pre>moneySegCtrl.setImage(UIImage(named: &quot;GBP.png&quot;), forSegmentAt: 1)</pre><pre>moneySegCtrl.setImage(UIImage(named: &quot;JP.png&quot;), forSegmentAt: 2)</pre><pre>moneySegCtrl.setImage(UIImage(named: &quot;EUR.png&quot;), forSegmentAt: 3)</pre><pre>} else{</pre><pre>moneySegCtrl.setTitle(&quot;美金&quot;, forSegmentAt: 0)</pre><pre>moneySegCtrl.setTitle(&quot;英GBP&quot;, forSegmentAt: 1)</pre><pre>moneySegCtrl.setTitle(&quot;日幣&quot;, forSegmentAt: 2)</pre><pre>moneySegCtrl.setTitle(&quot;EUR&quot;, forSegmentAt: 3)</pre><pre>}</pre><pre>}</pre><pre>//segmentcontrol換moneylabel文字標籤</pre><pre>@IBAction func changeMoneyLabel(_ sender: UISegmentedControl) {</pre><pre>if sender.selectedSegmentIndex == 0{</pre><pre>moneyLabel.text = &quot;美金&quot;</pre><pre>}else if sender.selectedSegmentIndex == 1{</pre><pre>moneyLabel.text = &quot;英GBP&quot;}else if sender.selectedSegmentIndex == 2{</pre><pre>moneyLabel.text = &quot;日幣&quot;}else{</pre><pre>moneyLabel.text = &quot;EUR&quot;}</pre><pre>}</pre><pre>//按下按鈕計算匯率<br></pre><pre>@IBAction func buttonExcMoney(_ sender: Any) {<br></pre><pre>//一按下計算button，鍵盤收回</pre><pre>MoneyInput.resignFirstResponder()</pre><pre>moneyOutput.resignFirstResponder()<br></pre><pre>var price = Double(MoneyInput.text!)</pre><pre>//currency變數直接在func中建立，不用另外宣告</pre><pre>func priceExchange (currency:Double){</pre><pre>if price != nil{</pre><pre>let ntPrice = price! * currency</pre><pre>//只要計算到小數點第二位</pre><pre>let ntPriceString = String(format: &quot;%.2f&quot;, ntPrice)</pre><pre>moneyOutput.text = ntPriceString</pre><pre>}</pre><pre>}</pre><pre>if moneySegCtrl.selectedSegmentIndex == 0{</pre><pre>priceExchange(currency: 30.5)</pre><pre>}else if moneySegCtrl.selectedSegmentIndex == 1{</pre><pre>priceExchange(currency: 37.5)</pre><pre>}else if moneySegCtrl.selectedSegmentIndex == 2{</pre><pre>priceExchange(currency: 0.27)</pre><pre>}else {</pre><pre>priceExchange(currency: 32.7)</pre><pre>}</pre><pre>}<br></pre><pre>//清空數字clear按鈕</pre><pre>@IBAction func buttonClear(_ sender: Any) {</pre><pre>MoneyInput.text = &quot;&quot;</pre><pre>moneyOutput.text = &quot;&quot;</pre><pre>}</pre><pre>}</pre><p>下次想要改進的地方：</p><ol><li>變成可雙向計算的即時匯率app</li><li>用array和for迴圈讀取segmented control圖片</li><li>再多研究幾個鍵盤收回的方式</li></ol><p>😃 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3663bc48d7b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E5%96%AE%E5%90%91%E9%9D%9E%E5%8D%B3%E6%99%82%E7%9A%84%E5%9F%BA%E6%9C%AC%E5%8C%AF%E7%8E%87app-3663bc48d7b8">單向非即時的基本匯率app 💰</a> was originally published in <a href="https://medium.com/peter-pan-swift-ios-class">彼得潘的 Swift iOS / Flutter App 開發教室</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[調色大師 — Ace Attorney ]]></title>
            <link>https://medium.com/@estie821/%E8%AA%BF%E8%89%B2%E5%A4%A7%E5%B8%AB-ace-attorney-b0a60aea599?source=rss-9d9f84d34e06------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0a60aea599</guid>
            <dc:creator><![CDATA[estie821]]></dc:creator>
            <pubDate>Fri, 08 May 2020 17:26:21 GMT</pubDate>
            <atom:updated>2020-05-08T17:26:21.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*R632LKoU0hqlcQQqZoWXvQ.png" /></figure><h3><strong><em>調色大師 — Ace Attorney 🕴</em></strong></h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstreamable.com%2Fo%2Fpyczcf&amp;display_name=Streamable&amp;url=https%3A%2F%2Fstreamable.com%2Fpyczcf&amp;image=https%3A%2F%2Fcdn-b-east.streamable.com%2Fimage%2Fpyczcf.jpg%3Ftoken%3DmAHsivKC3fq0RpSNueNnIA%26expires%3D1588963740&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=streamable" width="525" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/d55b834fbb3ac737022e288fddb3d5e9/href">https://medium.com/media/d55b834fbb3ac737022e288fddb3d5e9/href</a></iframe><p>程式碼：</p><pre>import UIKit</pre><pre>class ViewController: UIViewController {</pre><pre>@IBOutlet weak var clothsegmentedControl: UISegmentedControl!</pre><pre>@IBOutlet weak var fullAttorneypic: UIImageView!</pre><pre>@IBOutlet weak var tieView: UIView!</pre><pre>@IBOutlet weak var shirtView: UIView!</pre><pre>@IBOutlet weak var suitView: UIView!</pre><pre>@IBOutlet weak var redSlider: UISlider!</pre><pre>@IBOutlet weak var greenSlider: UISlider!</pre><pre>@IBOutlet weak var blueSlider: UISlider!</pre><pre>@IBOutlet weak var alphaSlider: UISlider!</pre><pre>override func viewDidLoad() {</pre><pre>super.viewDidLoad()</pre><pre>// Do any additional setup after loading the view.<br></pre><pre>//調整西裝、襯衫、領帶顏色</pre><pre>var image = UIImage(named: &quot;aceAttorney領帶&quot;)</pre><pre>let tieImageView = UIImageView(image: image)</pre><pre>tieImageView.frame = tieView.bounds</pre><pre>tieImageView.contentMode = .scaleAspectFit</pre><pre>tieView.mask = tieImageView</pre><pre>tieView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0)</pre><pre>//襯衫</pre><pre>image = UIImage(named: &quot;aceAttorney襯衫&quot;)</pre><pre>let shirtImageView = UIImageView(image: image)</pre><pre>shirtImageView.frame = shirtView.bounds</pre><pre>shirtImageView.contentMode = .scaleAspectFit</pre><pre>shirtView.mask = shirtImageView</pre><pre>shirtView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0)</pre><pre>//西裝</pre><pre>image = UIImage(named: &quot;aceAttorney西裝&quot;)</pre><pre>let suitImageView = UIImageView(image: image)</pre><pre>suitImageView.frame = suitView.bounds</pre><pre>suitImageView.contentMode = .scaleAspectFit</pre><pre>suitView.mask = suitImageView</pre><pre>suitView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0)</pre><pre>}</pre><pre>//以下為製作背景底圖隨機顏色按鈕</pre><pre>@IBAction func randomBackgroundColor(_ sender: Any) {</pre><pre>//先有random的數值</pre><pre>redSlider.value = Float.random(in: 0...1)</pre><pre>greenSlider.value = Float.random(in: 0...1)</pre><pre>blueSlider.value = Float.random(in: 0...1)</pre><pre>alphaSlider.value = Float.random(in: 0...1)</pre><pre>//將random數值傳入slider，這樣slider的圓點才會隨著顏色變化移動</pre><pre>fullAttorneypic.backgroundColor = UIColor(red: CGFloat(redSlider.value), green: CGFloat(greenSlider.value), blue: CGFloat(blueSlider.value), alpha: CGFloat(alphaSlider.value))</pre><pre>}</pre><pre>//segmente control選擇要調色的部分</pre><pre>//clothsegmentedControl是storyboard上UIsegmentedControl之名字</pre><pre>@IBAction func sliderChangeColor(_ sender: Any) {</pre><pre>if clothsegmentedControl.selectedSegmentIndex == 0{</pre><pre>tieView.backgroundColor = UIColor(red: CGFloat(redSlider.value), green: CGFloat(greenSlider.value), blue: CGFloat(blueSlider.value), alpha: CGFloat(alphaSlider.value))</pre><pre>}</pre><pre>if clothsegmentedControl.selectedSegmentIndex == 1{</pre><pre>shirtView.backgroundColor = UIColor(red: CGFloat(redSlider.value), green: CGFloat(greenSlider.value), blue: CGFloat(blueSlider.value), alpha: CGFloat(alphaSlider.value))</pre><pre>}</pre><pre>if clothsegmentedControl.selectedSegmentIndex == 2{</pre><pre>suitView.backgroundColor = UIColor(red: CGFloat(redSlider.value), green: CGFloat(greenSlider.value), blue: CGFloat(blueSlider.value), alpha: CGFloat(alphaSlider.value))</pre><pre>}</pre><pre>}<br></pre><pre>@IBAction func clothColorChamge(_ sender: UISegmentedControl) {</pre><pre>if sender.selectedSegmentIndex == 0{</pre><pre>tieView.backgroundColor = UIColor(red:CGFloat(redSlider.value), green:CGFloat(greenSlider.value), blue: CGFloat(blueSlider.value),alpha: CGFloat(alphaSlider.value))</pre><pre>}</pre><pre>if sender.selectedSegmentIndex == 1{</pre><pre>shirtView.backgroundColor = UIColor(red:CGFloat(redSlider.value), green:CGFloat(greenSlider.value), blue: CGFloat(blueSlider.value),alpha: CGFloat(alphaSlider.value))</pre><pre>}</pre><pre>if sender.selectedSegmentIndex == 2{</pre><pre>suitView.backgroundColor = UIColor(red:CGFloat(redSlider.value), green:CGFloat(greenSlider.value), blue: CGFloat(blueSlider.value),alpha: CGFloat(alphaSlider.value))</pre><pre>}</pre><pre>}</pre><pre>}</pre><p>參考資料：</p><p>感謝Peter的即時救援 😃～</p><ul><li><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/%E7%B0%A1%E6%98%93%E8%AA%AA%E6%98%8Excode%E4%B8%ADobject-library%E7%9A%84segmented-control-34fcf11f0b53">『簡易說明Xcode』Object Library的Segmented Control</a></li><li><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E6%95%99%E5%AE%A4/%E8%AA%BF%E8%89%B2%E5%A4%A7%E5%B8%AB-%E8%9B%8B%E7%B3%95%E9%85%8D%E8%89%B2-67837e175969">調色大師 — 蛋糕配色</a></li><li><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-swift-ios-app-%E9%96%8B%E7%99%BC%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E9%80%B2%E9%9A%8E%E7%9A%84%E8%AA%BF%E8%89%B2-app-%E5%A4%9A%E5%80%8B%E5%8D%80%E5%A1%8A%E7%9A%84%E8%91%97%E8%89%B2-d17e605cb820">進階的調色 App — 多個區塊的著色</a></li><li><a href="https://medium.com/%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84%E8%A9%A6%E7%85%89-%E5%8B%87%E8%80%85%E7%9A%84-100-%E9%81%93-swift-ios-app-%E8%AC%8E%E9%A1%8C/%E8%AA%BF%E8%89%B2%E5%A4%A7%E5%B8%AB-swift-ios-app-%E4%BD%9C%E6%A5%AD-a8ab4d968034">#13 調色大師</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0a60aea599" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[小王子，你不會畫畫你要先講啊～  ]]></title>
            <link>https://medium.com/@estie821/%E5%B0%8F%E7%8E%8B%E5%AD%90-%E4%BD%A0%E4%B8%8D%E6%9C%83%E7%95%AB%E7%95%AB%E4%BD%A0%E8%A6%81%E5%85%88%E8%AC%9B%E5%95%8A-73536fc58305?source=rss-9d9f84d34e06------2</link>
            <guid isPermaLink="false">https://medium.com/p/73536fc58305</guid>
            <dc:creator><![CDATA[estie821]]></dc:creator>
            <pubDate>Wed, 15 Apr 2020 09:35:42 GMT</pubDate>
            <atom:updated>2020-04-15T09:43:22.956Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XNkAf94kMIBuw9aZaM6IrQ.png" /></figure><p>小王子作者小時候畫了一幅畫，問大人是不是很可怕？</p><p>大人說：帽子有什麼可怕的？</p><p>小王子：我畫的並不是帽子，而是正在消化大象的蟒蛇。</p><p>為了幫助小王子揭露表象下所隱藏的真實，只好來作個帽子形狀遮罩 😜。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOimCCQ96QkSIQh0JJKgPg.png" /><figcaption>實作一：先找出圖1輪廓xy座標，再利用UIBezierPath和CAShapeLayer做出帽子圖，再使用CAGradientLayer作漸層上色(圖2)。實作二：找一個大象圖作為底圖，將圖1空白背景去背(留下帽子圖型當作剪影)，以作為大象底圖的遮罩。</figcaption></figure><blockquote><strong><em>實作方法：</em></strong></blockquote><pre>import UIKit</pre><pre>//實作一：<br>//圖片座標網站：<a href="https://yangcha.github.io/iview/iview.html">https://yangcha.github.io/iview/iview.html</a></pre><pre>//圖型繪製三步驟：<br>//step1: 生出一個UIBezierPath，繪製出形狀的路徑圖<br>//step2:生出一個CAShapeLayer並讓這個CAShaper路徑跟上一步驟用UIBezierPath所繪製路徑圖型的path一樣(產生CAShapeLayer透過path將它變成UIBezierPath繪製的形狀)<br>//step3:生成底圖UIView</pre><pre>//生出一個UIBezierPath，繪製出形狀的路徑圖<br>let hatpath = UIBezierPath()</pre><pre>//生出一個起始點，作為路徑圖的起點</pre><pre>var hatStartPoint = CGPoint(x: 104, y: 294)<br>hatpath.move(to: hatStartPoint)</pre><pre>//給剛剛的起始點一個新座標，並讓路徑圖走到新座標的位置</pre><pre>hatStartPoint = CGPoint(x: 107, y: 277)<br>hatpath.addLine(to: hatStartPoint)</pre><pre>//再給剛剛的起始點一個新座標，並讓路徑圖走到新座標的位置，repeat到圖形完成</pre><pre>hatStartPoint = CGPoint(x: 264, y: 256)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 312, y: 210)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 337, y: 82)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 397, y: 40 )<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 480, y: 41)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 606, y: 89)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 700, y: 90)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 749, y: 132)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 798, y: 248)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 831, y: 277)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 880, y: 286)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 1105, y: 282)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 1121, y: 305)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 759, y: 300)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 513, y: 299)<br>hatpath.addLine(to: hatStartPoint)<br>hatStartPoint = CGPoint(x: 382, y: 288)<br>hatpath.addLine(to: hatStartPoint)</pre><pre>// 走回最一開始的起點座標，將路徑圖關起來<br>hatpath.close()</pre><pre>//step2:生出一個CAShapeLayer,並讓這個CAShaper路徑跟上一步驟用UIBezierPath所繪製路徑圖型的path一樣</pre><pre>let hatlayer = CAShapeLayer()<br>hatlayer.path = hatpath.cgPath</pre><pre>//step3: 生一個UIView作為底圖，以在UIView上面放上前面兩步驟所產生的東西<br>//（產生UIView，透過mask將它變成CAShapeLayer設定的形狀）</pre><pre>let frame = CGRect(x: 0, y: 0, width: 1200, height: 350)<br>let view = UIView(frame: frame)</pre><pre>view.backgroundColor = UIColor(red: 147/255, green: 111/255, blue: 19/255, alpha: 1)</pre><pre>view.layer.mask = hatlayer</pre><pre>view</pre><pre>//生出一個GAGradientLayer作帽子顏色漸層，將GAGadientLayer加在step3的UIView上，<br>//GAGadientLayer為step3所生成的UIView的subview</pre><pre>let hatGradientLayer = CAGradientLayer()<br>hatGradientLayer.frame = view.bounds<br>hatGradientLayer.colors = [UIColor.yellow.cgColor, UIColor.brown.cgColor]</pre><pre>//上下漸層顏色的比例<br>hatGradientLayer.locations = [0.0, 0.65]</pre><pre>//左右斜向漸層<br>hatGradientLayer.startPoint = CGPoint(x: 0, y: 0)<br>hatGradientLayer.endPoint = CGPoint(x: 1, y: 1)</pre><pre>view.layer.addSublayer(hatGradientLayer)</pre><pre>view</pre><pre>//實作二：利用MASK設計特別形狀的圖片</pre><pre>let elephantImage = UIImage(named: &quot;大象_resized&quot;)</pre><pre>//有個功能叫.resizable().scaledToFit()？？<br>//--&gt;let elephantImage = UIImage(named: &quot;大象&quot;).resizerble().scaledToFit()這樣就不用調整圖片大小了？？</pre><pre>let elephantImageView = UIImageView(image: elephantImage)</pre><pre>let hatImage = UIImage(named: &quot;帽子去除背景&quot;)<br>let hatImageView = UIImageView(image: hatImage)</pre><pre>hatImageView</pre><pre>//大象圖上的mask遮罩為帽子圖（帽子圖作為大象圖上的mask)＠＠<br>elephantImageView.mask = hatImageView</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73536fc58305" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[米妮 Burberry風蝴蝶結開箱與製作過程大公開 :two_hearts:]]></title>
            <link>https://medium.com/@estie821/%E7%B1%B3%E5%A6%AE-burberry%E9%A2%A8%E8%9D%B4%E8%9D%B6%E7%B5%90%E9%96%8B%E7%AE%B1%E8%88%87%E8%A3%BD%E4%BD%9C%E9%81%8E%E7%A8%8B%E5%A4%A7%E5%85%AC%E9%96%8B-two-hearts-b7d2af9a5eab?source=rss-9d9f84d34e06------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7d2af9a5eab</guid>
            <dc:creator><![CDATA[estie821]]></dc:creator>
            <pubDate>Mon, 13 Apr 2020 14:13:29 GMT</pubDate>
            <atom:updated>2020-04-13T14:20:12.860Z</atom:updated>
            <content:encoded><![CDATA[<h3>米妮 Burberry風蝴蝶結開箱與製作過程大公開 💕</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kawSOd4Bgh2tEcouBjr21g.png" /></figure><p>迪士尼的經典明星Minnie Mouse與Burrbery聯名合作啦！！！</p><p>Burrbery鼠年限定，米妮專屬蝴蝶結搶先開箱～</p><p>來自英倫的百年精湛工藝，頂尖工藝大師親手繪製經典格紋，再搭配上米妮的巨星風采，走過路過千萬不要錯過～</p><blockquote><strong><em>製作過程大公開</em></strong></blockquote><figure><img alt="找張米妮圖，把米妮頭上蝴蝶結去背(蝴蝶結變透明)。再找張格紋滿版圖，將格紋圖當底，加入前面去背好的米妮圖當作子圖。" src="https://cdn-images-1.medium.com/max/1024/1*kawSOd4Bgh2tEcouBjr21g.png" /><figcaption>找張米妮圖，把米妮頭上蝴蝶結去背(蝴蝶結變透明)。再找張格紋滿版圖，將格紋圖當底，加入前面去背好的米妮圖當作子圖。</figcaption></figure><pre>import UIKit</pre><pre>var str = &quot;Hello, playground&quot;</pre><pre>//UIImage的米妮圖上蝴蝶結為透明<br>let miniImage = UIImage(named: &quot;米妮蝴蝶結去背.png&quot;)</pre><pre>//生成一個有UImageviewg上有米妮UIimage<br>let miniImageView = UIImageView(image: miniImage)</pre><pre>//以下為設定UIImageview顏色為綠色<br>//miniImageView.backgroundColor = UIColor(red:10/255, green: 186/255, blue: 181/255, alpha: 1)</pre><pre>//UIImageView背景設為格紋圖<br> <br>//UIImageView背景設為格紋圖寫法Ａ<br>//let patternUIImageView = UIImageView(frame: miniImageView.frame)<br>//<br>//patternUIImageView.image = UIImage(named: &quot;格紋圖&quot;)<br>//<br>//patternUIImageView.addSubview(miniImageView)<br>//<br>//patternUIImageView</pre><pre>//UIImageView背景設為格紋圖寫法Ｂ：UIImageView上有一個UIimage,那個UIimage上讀入圖片內容格紋圖檔<br>//顯示圖片的是UIImageView(A),而UIImageView(A上要顯示的內容必須另生個（Ｂ）UIImage控制，（Ｂ）UIImage才可傳入圖片資料。</pre><pre>let patterUIImageview = UIImageView(image: UIImage(named: &quot;格紋圖&quot;))</pre><pre>//要將格紋圖的UIImageVier上加入子圖，子圖為加入前面做好的米妮UIImageView就好，不是米妮UIImage。因為大階的米妮UIImageView裡面就已經涵蓋米妮UIImage。</pre><pre>patterUIImageview.addSubview(miniImageView)</pre><pre>patterUIImageview.frame = miniImageView.frame</pre><pre>patterUIImageview.layer.borderWidth = 10</pre><pre>//邊框顏色用CGCcolor不是UIColor 參考：自動轉換為 CGColor 的 color literals<br>//patterUIImageview.layer.borderColor = UIColor.red.cgColor</pre><pre>//邊框顏色的另種寫法，從UIColor中去得到CGColor的型別 示範色藍色<br>patterUIImageview.layer.borderColor = UIColor(red: 0, green: 0, blue: 1, alpha: 1).cgColor</pre><pre>//增加miniUIImageView的顏色為粉色，讓蝴蝶結變粉紅色格紋<br>miniImageView.backgroundColor = UIColor(red: 1, green: 0, blue: 0, alpha: 0.4)</pre><pre>//設成圓角<br>patterUIImageview.clipsToBounds = true<br>patterUIImageview.layer.cornerRadius = 225</pre><pre>patterUIImageview</pre><p>想知道更多米妮的最新動態嗎？趕快按下面的大頭貼追蹤米妮的IG</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*3WYgKAdaKwwdLZ1SwUO96A.png" /></figure><p>米妮換上新的大頭貼宣傳Burrbery聯名商品 😍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7d2af9a5eab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>