<?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 Shadow Hsieh on Medium]]></title>
        <description><![CDATA[Stories by Shadow Hsieh on Medium]]></description>
        <link>https://medium.com/@ppquitmax?source=rss-a7b3a1ebc332------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MaanJoBjz5BBswjc.jpg</url>
            <title>Stories by Shadow Hsieh on Medium</title>
            <link>https://medium.com/@ppquitmax?source=rss-a7b3a1ebc332------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 17:25:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ppquitmax/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[SwiftUI 全新體驗]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/swiftui-%E5%85%A8%E6%96%B0%E9%AB%94%E9%A9%97-7bd38557c2af?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bd38557c2af</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Sat, 21 Mar 2020 11:26:50 GMT</pubDate>
            <atom:updated>2020-03-21T12:00:59.693Z</atom:updated>
            <content:encoded><![CDATA[<p>久違的Swift我回來了！<br>荒廢了好久的Swift改變超多的感覺<br>是不是要重新來過👊<br>沒想到Swift全新進化，進化成SwiftUI<br>與先前的UIKit framework不同<br>SwiftUI更直覺，更精簡了</p><p>話不多說，馬上開一個新專案來試試看<br>一樣來到我們建立專案的畫面<br>選擇一個single view的新專案往下一步</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_DAtIWuKQThNNmb7MFilQ.png" /><figcaption>Create new project</figcaption></figure><p>我們可以看到系統已經幫我們預設為Swift UI<br>點開下拉選單可以看到之前的storyboard選項<br>這邊我們主要用的是SwiftUI，就不修改<br>選取好設定之後，就可以進入專案的畫面了</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*79O-ATNTyfuomMpd840Olw.png" /><figcaption>Project setting</figcaption></figure><p>專案畫面與先前的版本只有些許差異<br><strong><em>圖內標註1. </em></strong>專案內的檔案有一些不同<br>移除之前常用的.storyboard或ViewController<br>取而代之的是ContentView與SceneDelegate<br><strong><em>圖內標註2. </em></strong>編輯區塊有一區檔案總覽可以快速拖曳<br>當程式碼很多的時候就可以利用這一塊快速瀏覽<br><strong><em>圖內標註3.</em></strong> 這個區塊先前是用來顯示storyboard的畫面<br>現在SwiftUI是可以看到預覽的結果<br>這些是比較直覺可以馬上看到的差異</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9fGnd18whHilhDGl1tf0-w.png" /><figcaption>Window view</figcaption></figure><blockquote>預覽最大的特色就是可以即時觀看<br>預覽內容就會根據修改的內容改變</blockquote><p>例如我將Hello, world!改成Star Wars!<br>修改完的當下，右邊預覽的畫面就會改變</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1SVKfw6FBFX9DM2JjhwIvA.png" /><figcaption>Program preview</figcaption></figure><p>這次的紀錄先到這邊<br>單純體驗SwiftUI架構<br>接著應該會開始不定期更新（汗💦</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bd38557c2af" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/swiftui-%E5%85%A8%E6%96%B0%E9%AB%94%E9%A9%97-7bd38557c2af">SwiftUI 全新體驗</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[頁面間的資料傳遞（二）]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E9%A0%81%E9%9D%A2%E9%96%93%E7%9A%84%E8%B3%87%E6%96%99%E5%82%B3%E9%81%9E-%E4%BA%8C-e91eb9734d4?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/e91eb9734d4</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Tue, 28 Aug 2018 10:47:45 GMT</pubDate>
            <atom:updated>2018-08-28T10:47:45.041Z</atom:updated>
            <content:encoded><![CDATA[<p>在上一篇我們提到的資料傳遞是利用Button Title作為傳遞的資料<br>此篇我們找到先前做的<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/%E6%88%91%E7%9A%84%E7%AB%A5%E5%B9%B4%E5%9B%9E%E6%86%B6%E9%8C%84%E7%B6%93%E5%85%B8%E5%8B%95%E7%95%AB-a6f580ff7f77"><strong><em>動畫回憶錄</em></strong></a>，再次稍微改變一下作法<br>以Member頁面為例，每個cell都對應一個ViewController<br>如果利用資料傳遞的方式就可以節省很多獨立的ViewController</p><p>首先要建立Table的資料，拉出一個TableViewController<br>並在controller上embed一個NavigationController作為換頁後返回使用<br>cell的部分選用Dynamic prototypes，與先前的Static cell不一樣<br>並在cell上設計我們需要的元件，這邊需要用到imageView與Label</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bewBwS3by_NxG6z7Jtvtag.png" /><figcaption>Table View Controller setting</figcaption></figure><p>我們還需要針對這個TableView產生一個繼承UITableViewController的檔案<br>還有我們需要一組名為Member的struct來儲存我們要的資料<br>並宣告一個變數用來放array資料</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*pPUyZVjMa44c3rdIc32pmQ.png" /><figcaption>struct data</figcaption></figure><pre>var members = [Member]()</pre><p>底下我們先針對UITableViewController檔案裡面的一些function/參數做說明</p><p>在ViewDidLoad()底下預先指定members的內容<br>（原先的member人數18人，此處先取三位，其餘以此類推）<br>（info的內容先簡短以abcxxx暫定）</p><pre>members.append(Member(name: “日向仁”, imageName: “member01”, info: “abc123”))<br>members.append(Member(name: “月城飛鳥”, imageName: “member02”, info: “abc456”))<br>members.append(Member(name: “星山吼兒”, imageName: “member03”, info: “abc789”))</pre><p>目前Section只有一個，所以numberOfSections回傳數量為1</p><pre>override func numberOfSections(in tableView: UITableView) -&gt; Int {<br>    return 1<br>}</pre><p>其後有兩組名為tableView的function，作用是不一樣的，參數也不一樣<br>不過第二項預設是註解的，針對要使用Dynamic prototypes的case來說是要解開其註解的，這塊可以用來設計cell內容</p><ol><li>override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int<br>用來設定cell數量，這個例子裡回傳的是members.count<br>Load的時候就會根據count數量來顯示cell</li><li>override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell<br>這個function主要用來要設計cell內容，還需要新增一組繼承TableViewCell的檔案，並在裡面將cell中會用到的元件拉IBOutlet到檔案中，本例中會用到的有ImageView 與 Label，如下圖。<br>就可以直接呼叫元件修改其內容</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRgdDosnREwkiyrYHkOAQA.png" /><figcaption>IBOutlet setting for UITableViewCell</figcaption></figure><p>回到tableView中Cell就可以根據來源修改其元件上的內容</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhvKl1duAgJ6IDLXvoMJXA.png" /><figcaption>Cell setting</figcaption></figure><p>完成以上工作即可將內建的資料內容顯示在表格上面</p><p>接下來拉一個空白的頁面，放上ImageView, Label並結合前一個主題<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%A0%81%E9%9D%A2%E9%96%93%E7%9A%84%E8%B3%87%E6%96%99%E5%82%B3%E9%81%9E-%E4%B8%80-448579bd45dd"><em>頁面間的資料傳遞（一）</em></a><em> </em>“傳遞資料到下一頁”的內容，就可以將我們內建的資料完整資訊顯示在新的頁面當中。</p><p>ImageView用來顯示資料中的imageName，Label用來顯示資料中的info，至於name的部分就放在新頁面的NavigationItem的Title上即可。這樣就可以完成一個包含表格資訊跳轉頁面的列表App</p><p>底下輸出一個簡易的操作gif，右上方有個Edit是之後要再新增的內容。Comming Soon～</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*Xq6KlOn3NcgVoBjQb4oLaQ.gif" /><figcaption>Demo</figcaption></figure><p>Git上傳的內容已經包含可以簡易的修改現有資料，不過Edit頁面尚未做設計，單純只放簡單的元件在上面。</p><p><a href="https://github.com/papoymax352000/DataTransferPractice">papoymax352000/DataTransferPractice</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e91eb9734d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E9%A0%81%E9%9D%A2%E9%96%93%E7%9A%84%E8%B3%87%E6%96%99%E5%82%B3%E9%81%9E-%E4%BA%8C-e91eb9734d4">頁面間的資料傳遞（二）</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[頁面間的資料傳遞（一）]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E9%A0%81%E9%9D%A2%E9%96%93%E7%9A%84%E8%B3%87%E6%96%99%E5%82%B3%E9%81%9E-%E4%B8%80-448579bd45dd?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/448579bd45dd</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Wed, 11 Jul 2018 10:06:17 GMT</pubDate>
            <atom:updated>2018-07-11T10:06:17.574Z</atom:updated>
            <content:encoded><![CDATA[<p>總的來說，先前練習的內容都是事先建立好的頁面<br>如果主頁分別可以開啟A、B、C三個頁面<br>那就得事先準備好三個頁面的Controller及內容<br>接下來建立segue來觸發事件開啟目的頁面</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*vEWg6P3m1YrgDpUNM22dUA.png" /><figcaption>All controller setting</figcaption></figure><p>上述所說的執行序中並沒有帶著資料<br>顯示的頁面根據segue指向的Controller動作<br>有多少頁面就得拉多少segue<br>當ViewController一多，處理起來可能還會卡卡lag</p><p>那如果在執行序當中帶著資料<br>頁面內容是否就可以利用這些資料來做變化？<br>是不是也可以減少需要的Controller的量</p><p>資料傳遞又分別有兩種狀況：</p><ol><li>傳遞資料到下一頁</li><li>資料回傳到上一頁</li></ol><p>以下先針對傳遞資料到下一頁來做練習/說明<br>App在頁面切換上，我們多半都會拉好主畫面到下一頁的segue<br>並選擇換頁的方式要以show或是present去顯示</p><p>新生成的project內雖然有一組ViewController.swift的檔案<br>現在先刪除它再另外建立一個繼承UIViewController的檔案<br>在這個練習裡面會用到兩個畫面，所以新增兩組檔案</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJZchgyO5jxK42ZjO3pN8Q.png" /><figcaption>Add a new file for ViewController</figcaption></figure><p>在生成的檔案底下有個被封（ㄓㄨˋ）印（ㄐㄧㄝˇ）的<strong>func prepare<br></strong>解除它的註解（/**/）就可以透過該程序傳遞資料<strong><br></strong>其功能大意是：透過seque.destination獲取新的ViewControlle<br>並將選取的物件內容傳遞到新的ViewController去</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yXiNMW-vY0TnGqR7a1iijw.png" /><figcaption>Prepare function</figcaption></figure><p>接下來就看新頁面需要哪種呈現的方式，present或是push<br><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/%E4%B8%8D%E5%BE%9Estoryboard%E9%80%A3segue%E5%88%87%E6%8F%9B%E7%95%AB%E9%9D%A2-%E4%B8%80-7f1be39e1707"><em>不從Storyboard連segue切換畫面（一）</em></a><em><br></em><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/%E4%B8%8D%E5%BE%9Estoryboard%E9%80%A3segue%E5%88%87%E6%8F%9B%E7%95%AB%E9%9D%A2-%E4%BA%8C-adb1d4d503d4"><em>不從Storyboard連segue切換畫面（二）</em></a></p><p>初步完成單純換頁/返回後就可以開始以下資料的傳遞<br>我們先給按鈕兩個特定的名稱，新頁面新增ImageView用來顯示圖片<br>當執行新頁面換頁的時候，根據按鈕上的名稱顯示該人物照片<br>※在這邊要傳遞的資料就是“按鈕上的名稱”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W3xIh0y5F3TJYze81MQAvg.png" /><figcaption>Select Controller and Show Controller</figcaption></figure><p>這邊首先提到的是按鈕換頁不透過seque的方式<br>因為不透過seque，所以傳遞資料的方式不會用到prepare function<br>(喂～那你前面講這麼多到底是要做啥💢<br>雖然不會用到，不過兩種用法是差不多的<br>直接將資料傳遞的執行序放在Button觸發的func內</p><p>若是單純切換頁面或新頁面已經有固定的內容，不需要傳遞資料<br>我們就可以用先前提到的方式直接顯示新頁面</p><pre>if let controller = storyboard?.instantiateViewController(withIdentifier: “secondPage”) {<br>    present(controller, animated: true, completion: nil)<br>}</pre><p>可是我們要將按鈕上的文字當成資料傳送到新頁面<br>就不能用上面的方式，需要用新的方式<br>我們將最後要指向的storyboard ID轉型為ShowViewController<br>如果不轉型，無法取得該頁面的property</p><pre>if let controller = storyboard?.instantiateViewController(withIdentifier: &quot;PhotoView&quot;) as? ShowViewController {<br>    present(controller, animated: true, completion: nil)<br>}</pre><p>轉型後我們就可以存取新頁面的property，並作出修改/資料傳遞<br>但是⋯⋯但是，沒有錯，有但是⋯⋯</p><p>在畫面切換之前該有的Label, Image⋯⋯etc<br>這些畫面上的元件其實都還沒生成<br>不論option怎麼解都沒辦法修改的<br>能傳遞資料的只有變數可以當成容器存取</p><p>所以我們得先在ShowViewController上宣告一個變數<br>我們現在要傳遞的是字串，簡單宣告一個放字串的變數就好<br>這樣在轉型後的controller就可以存取nameText這個容器</p><pre>var nameText:String = “ ”</pre><p>在Button觸發的執行序中，我們將觸發源轉型為UIButton宣告成常數<br>要觸發換頁之前將剛才宣告的nameText抓進來改變，再present新頁面<br>改變的內容就根據按鈕的標題改變，點哪個新頁面就顯示哪個名稱</p><pre>let button = sender as? UIButton<br>if let controller = storyboard?.instantiateViewController(withIdentifier: “PhotoView”) as? ShowViewController {<br>  controller.nameText = (button?.currentTitle)!<br>  present(controller, animated: true, completion: nil)<br>}</pre><p>上述內容已經初步將我們要傳遞的資料（button title）丟到新頁面了</p><p>既然已經拿到資料了，我們就來看ShowViewController要怎麼處理</p><pre>@IBOutlet weak var myImageView: UIImageView!<br>@IBOutlet weak var nameLabel: UILabel!</pre><p>Show Page有兩個物件會用來呈現新頁面的內容<br>要改變物件內容的時候必須確定該物件已經生成<br>所以改變內容的程序就寫在ViewDidLoad()底下</p><pre>nameLabel.text = nameText</pre><pre>if nameText == “鬼宿” {<br>   myImageView.image = imageLiteral(resourceName: “pic01”)<br>} else if nameText == “星宿” {<br>   myImageView.image = imageLiteral(resourceName: “pic02”)<br>}</pre><p>把上述程序寫進去就可以完成“依據資料內容改變顯示內容”<br>可以發現依據的源頭都是nameText這個變數<br>其內容在頁面切換之前就已經從SelectViewController獲取資料了<br>剩下就是如何運用資料的部分，我是用來挑選顯示的圖片</p><p>Demo畫面如下，不同按鈕show不同的圖<br>不需要多個view對應不同的觸發按鈕<br>左上Label也可根據來源顯示不同內容</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*jx9OkjOqXY6w1FLXaJXK8A.gif" /><figcaption>DataTrans Demo</figcaption></figure><p><a href="https://github.com/papoymax352000/DataTransfer01">papoymax352000/DataTransfer01</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=448579bd45dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E9%A0%81%E9%9D%A2%E9%96%93%E7%9A%84%E8%B3%87%E6%96%99%E5%82%B3%E9%81%9E-%E4%B8%80-448579bd45dd">頁面間的資料傳遞（一）</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[不從Storyboard連segue切換畫面（二）]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%B8%8D%E5%BE%9Estoryboard%E9%80%A3segue%E5%88%87%E6%8F%9B%E7%95%AB%E9%9D%A2-%E4%BA%8C-adb1d4d503d4?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/adb1d4d503d4</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Tue, 19 Jun 2018 09:51:47 GMT</pubDate>
            <atom:updated>2018-06-19T09:55:33.492Z</atom:updated>
            <content:encoded><![CDATA[<p>上一篇文章中提到利用程式present新畫面的方式<br>此篇介紹另一種切畫面的方式，同樣不經過實體segue</p><p>相對於present — dismiss的顯示方式是push — pop<br>該方式不同的點在於只能作用於Navigation Controller上</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OTmlmeeEiVdenZa69gAEdQ.png" /><figcaption>View Controller embed Navigation Controller</figcaption></figure><p>首先一樣先幫原先的ViewController Embed Navigation Controller<br>有Navigation才有辦法觸發push新畫面的function<br>再拉出另一個新的ViewController作為欲切換的新畫面<br>續前篇，<a href="https://cdn-images-1.medium.com/max/1600/1*8KcqnOycS4pCGcrvT90yeQ.png"><em>一樣幫這兩個controller加上identity ID</em></a><em><br></em>不同的是我們要在Second View的畫面上加上NavigationItem<br>要切換也要有觸發源，所以先拉一個Button做準備</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VEilk3DVtHqfiqNaigx53w.png" /><figcaption>Adding a NavigationItem to Second View</figcaption></figure><p>NavigationItem加上之後不會在畫面上看到<br>但不用擔心，在左側元件欄裡可以看到該元件</p><p>因為First/Second兩個畫面間並沒有用segue連接<br>接下來就輪到用程式的方式來做畫面切換了：</p><p>把Button, NavigationItem都拉進來做IBOutlet</p><pre>@IBOutlet weak var myButton: UIButton!<br>@IBOutlet weak var myNavigationItem: UINavigationItem!</pre><p>Button還要再拉一個IBAction來放觸發時要做的事情</p><pre>@IBAction func ChangePage(_ sender: Any) {<br>}</pre><p>還記得拉了NavigationItem的IBOutlet嗎<br>由於我們拉完元件沒有為他設定title<br>所以用這樣的方式在viewDidLoad底下幫他加上title<br>這樣的方式我覺得(?)比較直覺啦（🚬）</p><pre>myNavigationItem.title = “First View”</pre><p>我們產生一個繼承UIViewController的檔案<br>將該檔案作為SecondView的class<br>這樣可以接著後續要在新畫面執行的程序</p><p>目前我們講的部分只是畫面切換<br>可以什麼都不做，不過<br>還記得我們有在Second View上拉一組NavigationItem嗎？</p><p>雖然從Storyboard畫面上看不到NavigationItem<br>不過我們一樣可以從元件列上拉IBOutlet到程式上<br>這邊同樣是為了透過程式設定Navigation的title<br>從下圖中viewDidLoad程式區中有看設定了title為Second View2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wGf6BEGwdnGsX6AkAxrwIA.png" /><figcaption>Setting Navigation outlet on Second View</figcaption></figure><p>將設定都做好就是一個簡單的畫面切換Demo<br>新畫面要回到前一頁會有Navigation的Back按鈕在畫面左上<br>點該按鈕即可回到前一頁，不用另外加Button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*szKbkeYLOijUQO9NxsR-7A.gif" /><figcaption>non-segue Navigation Controller Demo 01</figcaption></figure><p>咦，有發現Domo畫面上又多一個Page3的按鈕嗎？<br>這是一樣是要用來做Navigation切換用的按鈕</p><p>新增第三個ViewController並新增class檔案<br>這些設定與第二個畫面設定只有：不拉NavigationItem<br>第三個頁面的返回不透過Navigation Back Button<br>我們在畫面上額外拉一個實體的Button來返回</p><p>由於Navigation是影響全畫面的<br>由Navigation觸發換頁的畫面頂部也會有Navigation Bar<br>即使我們一開始設計畫面的時候沒有額外拉元件</p><p>所以將下段程式放在viewDidLoad裡面<br>一開始畫面準備好就將Navigation Bar隱藏</p><pre>self.navigationController?.setNavigationBarHidden(true, animated: false)</pre><p>這樣畫面就很乾淨剩下額外拉的Button元件<br>像我們在設計Storyboard的時候一樣</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*SjteYtRtXAggq-aMOsXCLw.png" /><figcaption>Third page setting</figcaption></figure><p>先前提過Navigation是透過push — pop來做畫面切換<br>上面例子裡面我們還是使用Navigation原生的Back按鈕<br>所以並沒有做到返回的程序（原生按鈕已幫我們做了）</p><p>接下來我們就拉Back Button的IBAction來做觸發程序<br>將處理Navigation Controller pop的程序放到func裡面<br>這樣我們在黃背景頁面就可以利用Button返回前頁</p><pre>self.navigationController?.popViewController(animated: true)</pre><p>不過黃頁面回到前頁之前還要記得將Navigation Bar叫回來<br>不然回到前頁之後會卡在Navigation Bar Hidden的狀態裡<br>這樣整合起來就可以不用手動拉segue也可以換頁/返回了</p><pre>self.navigationController?.setNavigationBarHidden(false, animated: false)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*SCg6c3fW68KwY0z9mRRLww.gif" /><figcaption>non-segue Navigation Controller Demo 02</figcaption></figure><p>完成手動換頁算是多頁設計入門了<br>接下來就是如何讓資料可以在頁面間傳遞<br>底下Project檔案連結作為紀錄</p><p><a href="https://github.com/papoymax352000/PushPopDemo">papoymax352000/PushPopDemo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adb1d4d503d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%B8%8D%E5%BE%9Estoryboard%E9%80%A3segue%E5%88%87%E6%8F%9B%E7%95%AB%E9%9D%A2-%E4%BA%8C-adb1d4d503d4">不從Storyboard連segue切換畫面（二）</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[不從Storyboard連segue切換畫面（一）]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%B8%8D%E5%BE%9Estoryboard%E9%80%A3segue%E5%88%87%E6%8F%9B%E7%95%AB%E9%9D%A2-%E4%B8%80-7f1be39e1707?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f1be39e1707</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Wed, 13 Jun 2018 10:30:01 GMT</pubDate>
            <atom:updated>2018-06-13T10:30:01.323Z</atom:updated>
            <content:encoded><![CDATA[<p>設計App切換畫面的時候多半都是從Storyboard上拉segue<br>舉凡利用Button, Navigation Bar, Tab Bar⋯⋯來切換畫面時</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*QfGymlSXP2iFnXaACZ69Wg.png" /><figcaption>Segue setting</figcaption></figure><p>建立切換畫面可以不用手動建立seque<br>也可以利用觸發事件來建立畫面切換<br>例如：點擊Button觸發點擊事件後由程式presen出新畫面</p><p>首先先在Storyboard上拉出一個新的Viewcontroller作為新畫面<br>新增一份新的Viewcontroller2.swift檔案並由新畫面選擇<br>在原先/新的Viewcontroller的identity頁面上新增各自的ID<br>1. firstPage<br>2. secondPage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8KcqnOycS4pCGcrvT90yeQ.png" /><figcaption>Viewcontroller identity setting</figcaption></figure><p>兩個畫面都放置一個Button元件<br>原畫面作轉場用，新畫面用來退回舊畫面<br>在viewDidLoad加上圓角（到底多愛圓角</p><p>為Button拉一個IBAction建立觸發程序<br>並將以下內容加入程序內</p><pre>if let controller = storyboard?.instantiateViewController(withIdentifier: “secondPage”) {<br>    present(controller, animated: true, completion: nil)<br>}</pre><p>其中產生畫面為底下的方法，但前提是要有該畫面<br>而這個withIdentifier就是我們設定的畫面ID<br>因為不一定有畫面存在所以該方法所產生結果為Optional<br>故上面原內容才會以Optional Chaining的方式來處理</p><pre>storyboard?.instantiateViewController(withIdentifier:String)</pre><p>而在這邊顯示新畫面的方法為“present”<br>這種顯示方式是將新畫面由最底下往上推上來</p><pre>present(viewControllerToPresent: UIViewController:UIViewController, animated: Bool, completion: (() -&gt; Void)?)</pre><p>第一個參數為要顯示的controller ID，這邊填入設定的ID<br>第二個參數為是否要顯示動畫，畫面由下往上顯示<br>第三個參數是一個closure，若不新增程序可為 “nil”<br>基本上Button觸發程序這邊寫好之後就可以達成顯示新畫面的結果</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ip2O6ExOoud2V7UNGe6sPA.gif" /><figcaption>Page changing by Button</figcaption></figure><p>既然都可以切換到新頁面了<br>再利用Button回到原本的畫面應該也沒有問題？</p><p>首先我們切換畫面是透過present<br>所以回到原畫面要搭配的動作就是“dismiss”<br>（還有push — pop，這又是後話了🚬）</p><p>退回的部分將程序加在開專案時新增的Viewcontroller2.swift裡面<br>當然不免俗在Button上還是要圓角啊（喂～</p><pre>dismiss(animated: Bool, completion: (() -&gt; Void)?)</pre><p>退回的部分只有兩個參數<br>第一個為是否顯示動畫，退回的部分動畫方向與顯示反方向<br>第二個參數也是一個closure，如果不新增程序可為“nil”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*6w40RnWwDBy59NAa3nZwHw.gif" /><figcaption>Page back by Button</figcaption></figure><p>雖然只是簡單練習present — dismiss<br>一樣上傳到GitHub供參考也留個紀錄</p><p><a href="https://github.com/papoymax352000/Non-seguePresent">papoymax352000/Non-seguePresent</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f1be39e1707" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%B8%8D%E5%BE%9Estoryboard%E9%80%A3segue%E5%88%87%E6%8F%9B%E7%95%AB%E9%9D%A2-%E4%B8%80-7f1be39e1707">不從Storyboard連segue切換畫面（一）</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/%E6%93%87%E5%81%B6%E6%A2%9D%E4%BB%B6app-%E3%81%B5%E3%81%97%E3%81%8E%E9%81%8A%E6%88%AF%E7%AF%87-f5b519162146?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5b519162146</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Mon, 11 Jun 2018 07:56:07 GMT</pubDate>
            <atom:updated>2018-06-11T07:56:07.641Z</atom:updated>
            <content:encoded><![CDATA[<p>本次練習判斷的條件多了UISwitch<br>其餘判斷基本與前面練習差不多<br>這次圖片來源是當年虐了不少少男少女心的“ふしぎ遊戯”</p><p>將判斷條件中成立的全部放在一起<br>這樣只要其中一項不符合就不會成立<br>也節省了使用到多層判斷<br>另外在判斷起始先確定是否有輸入星座或選擇性別</p><p>最後在輸出結果的時候將性別條件加入<br>選男性就顯示女性回答，女性則是男性回答</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c78d3017babe25c0cf6280b2fabb4a13/href">https://medium.com/media/c78d3017babe25c0cf6280b2fabb4a13/href</a></iframe><p>顯示結果部分基本都是使用同一個ImageView<br>判斷條件來改變ImageView內的圖片<br>Reset按鈕清除所有條件，回到初始狀態</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*8eoHNVzqxqLSlqBbW_dVNA.gif" /><figcaption>App Demo</figcaption></figure><p><a href="https://github.com/papoymax352000/choosingMrRight">papoymax352000/choosingMrRight</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5b519162146" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E6%93%87%E5%81%B6%E6%A2%9D%E4%BB%B6app-%E3%81%B5%E3%81%97%E3%81%8E%E9%81%8A%E6%88%AF%E7%AF%87-f5b519162146">擇偶條件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 — 回覆特定keyword的笨AI]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E9%90%B5%E6%9D%BF%E7%A5%9E%E7%AE%97app-%E5%8F%AA%E6%9C%89%E7%89%B9%E5%AE%9Akeyword%E7%9A%84%E7%AC%A8ai-cef62806c486?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/cef62806c486</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Thu, 31 May 2018 07:54:14 GMT</pubDate>
            <atom:updated>2018-05-31T07:55:12.435Z</atom:updated>
            <content:encoded><![CDATA[<p>這次要做一個回覆特定字串的問答型app<br>老實說這種系列題目我還真沒辦法想到太多內容<br>找了兩項比較普遍會有人想知道的方向來做</p><p>要判斷字串內容有幾項關鍵屬性能用:</p><ol><li>hasPrefix: 是否以XXX字串開頭</li><li>hasSuffix: 是否以XXX字串結尾</li><li>contains: 字串中是否包含XXX</li></ol><p>而這次練習只針對contains這個判斷屬性來做</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/238c332a0d36ffa1784e6394b4e30b05/href">https://medium.com/media/238c332a0d36ffa1784e6394b4e30b05/href</a></iframe><p>Button Function用來判斷字串內容，並在Label上更新結果回覆<br>額外判斷沒有輸入問題的狀況/增加不符合任何判斷結果的回覆內容<br>回覆的內容也結合ramdon產生不一樣的結果</p><p>問題輸入的部分另外做收合得function<br>讓使用者輸入完內容，按下return後收合鍵盤<br>這部分的功能參考Peter的教學</p><p><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%A3%E7%B5%90-uitextfield-%E7%9A%84-did-end-on-exit-event-%E6%8C%89%E4%B8%8B-return-%E9%8D%B5%E6%94%B6%E9%8D%B5%E7%9B%A4-5b3f2f4aeb03">連結 UITextField 的 Did End On Exit event，按下 return 鍵收鍵盤</a></p><p>使用者輸入內容的情境也做稍微調整<br>從設計的畫面來看，輸入框text在畫面下端<br>當呼叫鍵盤要輸入的時候會擋住text</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*awnu54T5ISIk-2fEXbiiew.png" /><figcaption>Textfield be blocked</figcaption></figure><p>這時需要調整畫面將view拉高讓text不會被擋住<br>這部分有參考網路上找到的教學文章來測試<br>底下這篇文章為監聽button做一個簡略地說明</p><p><a href="https://h81061678.blogspot.tw/2016/09/swift-23.html">監聽動作 (Swift)</a></p><p>不過我們這部分是針對 “跳出鍵盤”/“收合鍵盤”<br>所以將監聽的部分做了修改做出我們要的效果</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8f128df4d14c67f79d346d7a8741aea/href">https://medium.com/media/d8f128df4d14c67f79d346d7a8741aea/href</a></iframe><p>ViewDidLoad底下新增監聽式，執行時開始進行監聽<br>self: 是指向要監聽的地方<br>selector: 選擇收到通知時要要執行的method，func前需加上“@objc”<br>name: 監聽的Notification類型<br>object: nil，沒有特別指定接收物件，故為nil</p><p>額外建立處理通知的function<br>內容為調整view的位置往上/下</p><pre>@objc func keyboardWillShow()<br>@objc func keyboardWillHide()</pre><p>原本有找一個獲取鍵盤高度後<br>依據鍵盤高度後調整view的方法<br>不過獲取的結果還有點問題<br>所以暫時先以別的方式調整高度<br>view要調整的高度來源為</p><pre>UIScreen.main.bounds.height/2–80</pre><p>底下為稍微demo的縮圖，最後附上GitHub連結</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*o7H3LglI3VTVtDGLEISpLQ.gif" /></figure><p><a href="https://github.com/papoymax352000/Fortune-telling">papoymax352000/Fortune-telling</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cef62806c486" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E9%90%B5%E6%9D%BF%E7%A5%9E%E7%AE%97app-%E5%8F%AA%E6%9C%89%E7%89%B9%E5%AE%9Akeyword%E7%9A%84%E7%AC%A8ai-cef62806c486">鐵板神算app — 回覆特定keyword的笨AI</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/%E7%98%8B%E7%8B%82%E8%B3%BC%E7%89%A9app-%E6%BB%91%E6%9D%BF%E7%B6%B2%E8%B3%BC%E7%89%88-d3a5a2878b9c?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a5a2878b9c</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Fri, 25 May 2018 07:05:37 GMT</pubDate>
            <atom:updated>2018-05-25T07:05:37.621Z</atom:updated>
            <content:encoded><![CDATA[<p>先前看過一些網路youtuber出門代步都會用滑板<br>甚至做了自己的電動滑板，完全不用靠力氣滑<br>當下就覺得好酷，突然想要敗家的衝動<br>鑑於這個弱小的心願就來做一款購買滑板的app簡易版</p><p>這個app做的很陽春，也只有單一畫面<br>很多網路文章/新聞/甚至購物網頁頂端都有一個廣告(?)<br>所以我在畫面上方放一個Imageview，打算用來當廣告<br>找了4個滑板的圖片當購物參考圖，並標示上價格<br>下圖為畫面呈現的樣子</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*XpCGyrex3BNdkc2NnKMRkA.png" /><figcaption>Shopping app view</figcaption></figure><p>只用一個Imageview做出廣告輪播是參考底下的文章連結</p><p><a href="http://boywhy.blogspot.tw/2016/12/iosimageview_17.html">「iOS」ImageView 輪播圖片</a></p><p>我將function單獨拉出來到Git上可以參考<br>Function建立在Viewcontroller底下，viewDidLoad之後呼叫即可</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8c1fbb7bf440d7ab376164caadfb50a/href">https://medium.com/media/c8c1fbb7bf440d7ab376164caadfb50a/href</a></iframe><p>最後合計顯示價錢的部分，因為直接套上字串會沒有千位的逗號“,”<br>所以另外找了讓最後顯示的價錢也可以有千位逗號<br>過程參考底下連結</p><p><a href="https://blog.csdn.net/C_calary/article/details/52895762">Swift3.0 数字格式化（金额逗号分隔） - CSDN博客</a></p><p>在Viewcontroller底下初始化一個變數為NumberFormmatter物件</p><pre>var totalValue = NumberFormatter()</pre><p>到呼叫到物件的function底下改變該物件的屬性<br>輸出樣式在上面的連結裡面有提到<br>有不同的顯示數字的方式可以選擇</p><pre>totalValue.numberStyle = .decimal</pre><p>接下來將最後的金額帶入該物件後顯示在label上即可<br>大概像底下片段程式的方式就可以改變顯示格式<br>另外將顯示的類型補充在片段註解裡面供參考用</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4928693c7446363c06fca784c60b3850/href">https://medium.com/media/4928693c7446363c06fca784c60b3850/href</a></iframe><p>最後呈上操作demo動態圖與GitHub連結</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*6ZKGIFt3awV8xZTsbiY4DA.gif" /><figcaption>Shopping App Demo</figcaption></figure><p><a href="https://github.com/papoymax352000/shopping">papoymax352000/shopping</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a5a2878b9c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E7%98%8B%E7%8B%82%E8%B3%BC%E7%89%A9app-%E6%BB%91%E6%9D%BF%E7%B6%B2%E8%B3%BC%E7%89%88-d3a5a2878b9c">瘋狂購物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[修改Tab Bar Icon設定顯示原圖]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BF%AE%E6%94%B9tab-bar-icon%E8%A8%AD%E5%AE%9A%E9%A1%AF%E7%A4%BA%E5%8E%9F%E5%9C%96-78330b375b5e?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/78330b375b5e</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Tue, 22 May 2018 07:58:40 GMT</pubDate>
            <atom:updated>2018-05-22T07:58:40.398Z</atom:updated>
            <content:encoded><![CDATA[<p>製作<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/%E6%88%91%E7%9A%84%E7%AB%A5%E5%B9%B4%E5%9B%9E%E6%86%B6%E9%8C%84%E7%B6%93%E5%85%B8%E5%8B%95%E7%95%AB-a6f580ff7f77"><strong><em>雷神王回憶錄</em></strong></a>的時候有使用Tab Bar Controller<br>建立分頁後也有製作幾個給不同分頁使用的小icon<br>但是顯示出來的結果都是單色icon樣式</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*ZL5okxI8y2IoLEfmRGhnIQ.png" /><figcaption>Simply icon style</figcaption></figure><p>今天無意間發現彼得潘在早前就有教學了</p><p><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/%E8%AE%93-navigation-bar-tab-bar-tool-bar-%E7%9A%84-icon-%E9%A1%AF%E7%A4%BA%E5%8E%9F%E6%9C%AC%E7%9A%84%E5%BD%A9%E8%89%B2%E5%9C%96%E7%89%87-e0d98108f0da">用 UIImageRenderingMode 讓 button &amp; bar 的 icon 顯示原本的彩色圖片</a></p><p>有這麼好的消息怎麼可以不馬上測試呢<br>馬上打開之前的檔案來設定</p><p>將要改設定的圖片都選好之後（可以一次選擇多個檔案）<br>在右邊的設定欄裡面把Render As改成Original Image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0iTbjVQPsaRldPdYFsjcrA.png" /><figcaption>Render As setting</figcaption></figure><p>修改後的畫面看起來漂亮多了</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*tbXi78umAAdfm1pr2QIGmg.png" /><figcaption>After Icon setting</figcaption></figure><p>重新上傳GitHub</p><p><a href="https://github.com/papoymax352000/RaiJinOh">papoymax352000/RaiJinOh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78330b375b5e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BF%AE%E6%94%B9tab-bar-icon%E8%A8%AD%E5%AE%9A%E9%A1%AF%E7%A4%BA%E5%8E%9F%E5%9C%96-78330b375b5e">修改Tab Bar Icon設定顯示原圖</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[Tab Bar相關功能及設定]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/tab-bar%E7%9B%B8%E9%97%9C%E5%8A%9F%E8%83%BD%E5%8F%8A%E8%A8%AD%E5%AE%9A-1e2a77dd30fd?source=rss-a7b3a1ebc332------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e2a77dd30fd</guid>
            <dc:creator><![CDATA[Shadow Hsieh]]></dc:creator>
            <pubDate>Tue, 22 May 2018 06:58:10 GMT</pubDate>
            <atom:updated>2018-05-22T06:58:10.089Z</atom:updated>
            <content:encoded><![CDATA[<p>使用者在使用App的時候是不是都有遇到<br>可以利用不同的icon切換不同畫面的App（如Facebook app, Instagram等等）<br>底下要來提出一些屬性的設定來說明<br>不過首先來了解一下Tab Bar是怎麼產生的</p><p>Tab Bar是屬於Tab Bar Controller裡的一個物件<br>生成Tab Bar Controller可以從Library裡面拉現成的<br>也可以直接利用一般的View Controller生成：</p><ol><li>點選到單一的View Controller項目上</li><li>選擇工具列上的Editor➔Embed in➔Tab Bar Controller</li></ol><p>現在來看Tab Bar上的相關屬性設定<br>首先來看看Translucent這個設定（default是打開的）<br>這是讓Tab Bar可以半透明的設定（在Navigation Bar也有相同的屬性）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Mey0HpS35MlcvESzwso0Ow.png" /><figcaption>Translucent setting</figcaption></figure><p>以iPhoneX為例，可以發現底下touch bar(?)橫槓往上移動了<br>表示底下的空間已經固定為Tab Bar所用<br>View所能顯示的空間壓縮到僅Tab Bar上面的空間</p><p>Tab Bar也可以改變顏色，不是一層不變的白底（灰階？）<br>可以從Style選項將Bar顏色變成黑色（僅default/black）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bmIsOy_78vNB99bgyCn2Gg.png" /><figcaption>Tab Bar Style setting</figcaption></figure><p>如果有需求將Tab Bar設計成其他顏色<br>也可以利用Bar Tint的選項改變顏色</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojTXcVNdwfpkfIbrWcaXUw.png" /><figcaption>Bar Tint setting</figcaption></figure><p>Tab Bar Controller上有一個Hide Bottom on Push的功能<br>意指觸發push的動作時隱藏底下的Bar<br>Navigation切換到新畫面就是以push方式產生<br>底下結合Navigation Controller做一個測試練習</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnT6UsG7v6vNX2sergHjOA.png" /><figcaption>Combine Navigation Controller &amp; Tab Bar Controller</figcaption></figure><p>Navigation跳頁之後不想看到底下的Bar<br>首先選擇最後目的的view上的設定<br>可以看到Hide Bottom on Push的選項<br>勾選該項目就可以看到頁面底部的Bar消失了</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ji11jq5eMT1f-Nu3o9wqLw.png" /><figcaption>Bottom Bar disappeared</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e2a77dd30fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/tab-bar%E7%9B%B8%E9%97%9C%E5%8A%9F%E8%83%BD%E5%8F%8A%E8%A8%AD%E5%AE%9A-1e2a77dd30fd">Tab Bar相關功能及設定</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>
    </channel>
</rss>