<?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 Baaro on Medium]]></title>
        <description><![CDATA[Stories by Baaro on Medium]]></description>
        <link>https://medium.com/@baaro.lin?source=rss-d0b28dfee9ee------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pPvQTuNJqtNmE5Wf</url>
            <title>Stories by Baaro on Medium</title>
            <link>https://medium.com/@baaro.lin?source=rss-d0b28dfee9ee------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:11:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@baaro.lin/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[作業9：⭐️ 心理測驗或問卷 App]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD9-%EF%B8%8F-%E5%BF%83%E7%90%86%E6%B8%AC%E9%A9%97%E6%88%96%E5%95%8F%E5%8D%B7-app-b63fbd227164?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/b63fbd227164</guid>
            <category><![CDATA[quiz]]></category>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Sun, 02 Aug 2020 13:23:26 GMT</pubDate>
            <atom:updated>2020-08-02T14:05:45.243Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lspZQwiHCsLuuACJ" /><figcaption>Photo by <a href="https://unsplash.com/@everywheresean?utm_source=medium&amp;utm_medium=referral">Sean Do</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>正在我在找有啥心理測驗時，</p><p>都要看到一堆廣告跟點讚，</p><p>而且也沒有較好的公式可以抄，</p><p>突然想到我很久很久以前好像有第一次做過。</p><p>沒錯！那就是這次測驗的主題了！！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*LBRxKuBHdrkvkK7s-sL8wg.jpeg" /></figure><blockquote>RO的一轉性向測驗！！</blockquote><p>題目與各種分數都有人紀錄了。</p><p><a href="https://forum.gamer.com.tw/Co.php?bsn=04212&amp;sn=2263355">RE:【問題】初學者 性向測驗 @RO 仙境傳說 Online 哈啦板 - 巴哈姆特</a></p><p>參照這些題目就可以好好做作業了😃</p><p>附上畫面與Github</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*e2AbbbTko0js_X4y-fmVzw.gif" /></figure><p><em>年過30還是只能當法師........</em></p><p><a href="https://github.com/show0007/quizDemo">show0007/quizDemo</a></p><p>各裝置畫面</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YyvDdfo9KHZz7GznXG7O7A.gif" /></figure><p>4s 圖片小道看不到了，就先無視吧。</p><p>功能說明：</p><ol><li>問題 &amp; 選項隨機</li><li>問題問完後跳轉到顯示推薦畫面</li><li>用 Autolayout 調整畫面顯示，通用各種裝置。</li></ol><p>大部分的說明都在程式碼裡面了，</p><p>在參考Github吧</p><p>Quiz.swift：放各種<strong>struct enum </strong>還有問題跟最後介紹，分數計算。</p><p>QuizViewController.swift：主要問題controller</p><p>ResultViewController.swift：最後結果，推薦職業controller</p><blockquote>參考連結：</blockquote><ul><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/16-%E5%BF%83%E7%90%86%E6%B8%AC%E9%A9%97%E6%88%96%E5%95%8F%E5%8D%B7-app-d8910d1345e">#16 心理測驗或問卷 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/%E7%B0%A1%E6%98%93%E8%AA%AA%E6%98%8Excode%E4%B8%AD%E7%9A%84%E8%B3%87%E6%96%99%E5%82%B3%E9%81%9E-%E4%BD%BF%E7%94%A8prepare%E5%82%B3%E9%81%9Eproperty%E7%9A%84%E6%96%B9%E5%BC%8F-a5666ca36114">『簡易說明Xcode』資料傳遞（使用Prepare傳遞Property的方式）</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%A6%AC%E4%B8%8A%E6%B8%AC%E9%A9%97%E7%9C%8B%E7%9C%8B-%E4%BD%A0%E5%9C%A8-%E5%93%88%E5%88%A9%E6%B3%A2%E7%89%B9-%E7%9A%84%E9%9C%8D%E6%A0%BC%E8%8F%AF%E8%8C%B2%E9%AD%94%E6%B3%95%E5%AD%B8%E6%A0%A1%E4%B8%AD%E6%9C%83%E8%A2%AB%E5%88%86%E5%88%B0%E5%93%AA%E4%B8%80%E5%80%8B%E5%AD%B8%E9%99%A2-5540f99a55c7">馬上測驗看看，你在《哈利波特》的霍格華茲魔法學校中會被分到哪一個學院？</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/%E5%BF%83%E7%90%86%E6%B8%AC%E9%A9%97-%E6%98%8E%E5%B9%B4%E4%BD%A0%E8%83%BD%E6%93%BA%E8%84%AB%E5%96%AE%E8%BA%AB%E5%97%8E-5f1fe20f9bdc">心理測驗 — 明年你能擺脫單身嗎？</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/%E4%BD%9C%E6%A5%AD-6-10-%E5%BF%83%E7%90%86%E6%B8%AC%E9%A9%97%E4%B9%8B%E6%8B%9B%E6%90%96%E6%92%9E%E9%A8%99app%E7%AC%AC%E4%BA%8C%E5%BD%88-e8c3926e4c96">作業#6.10 — 心理測驗之招搖撞騙APP第二彈</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b63fbd227164" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD9-%EF%B8%8F-%E5%BF%83%E7%90%86%E6%B8%AC%E9%A9%97%E6%88%96%E5%95%8F%E5%8D%B7-app-b63fbd227164">作業9：⭐️ 心理測驗或問卷 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[作業6-2： 模仿 iOS 的 Music App 製作情歌點唱機，可忽略進階功能]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD6-2-%E6%A8%A1%E4%BB%BF-ios-%E7%9A%84-music-app-%E8%A3%BD%E4%BD%9C%E6%83%85%E6%AD%8C%E9%BB%9E%E5%94%B1%E6%A9%9F-%E5%8F%AF%E5%BF%BD%E7%95%A5%E9%80%B2%E9%9A%8E%E5%8A%9F%E8%83%BD-ff622f74ffc0?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff622f74ffc0</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[music-player]]></category>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Mon, 27 Jul 2020 06:56:35 GMT</pubDate>
            <atom:updated>2020-07-27T08:45:46.930Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yyA40OIYl5w2otZM" /><figcaption>Photo by <a href="https://unsplash.com/@karaeads?utm_source=medium&amp;utm_medium=referral">Kara Eads</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSyDKJsN4lzg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSyDKJsN4lzg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSyDKJsN4lzg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8abaa0a5946ac5d5cdb6959d31189f9/href">https://medium.com/media/a8abaa0a5946ac5d5cdb6959d31189f9/href</a></iframe><p><a href="https://github.com/show0007/musicPlayer">show0007/musicPlayer</a></p><blockquote>主要功能</blockquote><ol><li>播放/暫停</li><li>上、下一首</li><li>更新image、歌手名稱、歌曲名稱</li><li>Slider 調整播放進度</li><li>Slider 播放進度時間、總時間</li><li>音量調整(非系統)</li><li>隨機播放、循環播放、單曲播放</li><li>背景&amp;鎖定播放</li><li>背景播放時，系統可控制播放、上下一首並顯示歌曲資訊</li></ol><p>音樂播放相關的程式碼就不額外放上來了，</p><p>只提一些我覺得比較重要的東西。</p><pre>func updatePlayerUI() {<br>        //更新總時間&amp; Slider 的Value<br>        guard let duration = playerItem?.asset.duration else {<br>            return<br>        }<br>        //轉為歌曲的總時間<br>        let seconds = CMTimeGetSeconds(duration)<br>        //在Label顯示歌曲總時間<br>        totalPlayLabel.text = formatConversion(time: seconds)<br>        slider.minimumValue = 0<br>        slider.maximumValue = Float(seconds)<br>        slider.isContinuous = true<br>    }</pre><p>取歌曲的總時間(秒)，並設定slider。</p><pre>func CurrentTime() {<br>        //監聽現在播放時間&amp;換Slider的Value<br>        player.addPeriodicTimeObserver(forInterval: CMTimeMake(value: 1, timescale: 1), queue: DispatchQueue.main, using: { (CMTime) in<br>            if self.player.currentItem?.status == .readyToPlay {<br>                let currentTime = CMTimeGetSeconds(self.player.currentTime())<br>                self.slider.value = Float(currentTime)<br>                self.nowPlayLabel.text = self.formatConversion(time: currentTime)<br>            }<br>        })<br>    }</pre><p>現在播放時間，並更新Slider Value and Label Text。</p><pre>func checkMusicIsEnd(){<br>        //偵測是否播放到最後<br>        NotificationCenter.default.addObserver(forName: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil, queue: .main) { (_) in<br>            if self.repeatOnePlay{<br>                //回到0秒 繼續播放<br>                let targetTime:CMTime = CMTimeMake(value: 0, timescale: 1)<br>                self.player.seek(to: targetTime)<br>                self.player.play()<br>            }else{<br>                self.playNextMusic()<br>            }<br>        }<br>    }</pre><p>播放完畢後的動作。</p><pre>    func createPlayAry(){<br>        //創建playArray<br>        for i in 0 ..&lt; musicList.count{<br>            playAry.append(i)<br>        }<br>        <br>    }<br>    func sortPlayAry(){<br>        //playArray 清單排序<br>        playAry.sort()<br>    }<br>    func shufflePlayAry(){<br>        //playArray 清單亂序排序<br>        playAry.shuffle()<br>    }</pre><p>播放列表，亂序or排序。</p><p><strong>設定背景&amp;鎖定播放</strong></p><pre>//  設定背景&amp;鎖定播放<br>    func setupRemoteTransportControls() {<br>        // Get the shared MPRemoteCommandCenter<br>        let commandCenter = MPRemoteCommandCenter.shared()<br>        <br>        // Add handler for Play Command<br>        commandCenter.playCommand.addTarget { [unowned self] event in<br>            if self.player.rate == 0.0 {<br>                self.player.play()<br>                return .success<br>            }<br>            return .commandFailed<br>        }<br>        <br>        // Add handler for Pause Command<br>        commandCenter.pauseCommand.addTarget { [unowned self] event in<br>            if self.player.rate == 1.0 {<br>                self.player.pause()<br>                return .success<br>            }<br>            return .commandFailed<br>        }<br>        commandCenter.nextTrackCommand.addTarget{ [unowned self] event in<br>            self.playNextMusic()<br>            return .success<br>        }<br>        commandCenter.previousTrackCommand.addTarget{ [unowned self] event in<br>            self.playPreviousMusic()<br>            return .success<br>        }<br>    }</pre><p><strong>playCommand ：背景播放按鈕設定。</strong></p><p><strong>pauseCommand：背景暫停按鈕設定。</strong></p><p><strong>nextTrackCommand：背景下一首按鈕設定。</strong></p><p><strong>previousTrackCommand：背景上一首按鈕設定。</strong></p><p>上下一首的.success不確定有沒有必要加入，可能需要在試試看才知道了。</p><p>另外，調整系統音量內建好像已經幫你用好了，不用在自己加入。</p><p><strong>commandCenter</strong>還有其他的東西可以用，有興趣的可以在自己研究。</p><h4><strong>背景播放時的歌曲資訊</strong></h4><pre>//  設定背景播放的歌曲資訊<br>    func setupNowPlaying() {<br>        // Define Now Playing Info<br>        let songName:String = (self.musicList[playAry[playNum]].trackName)<br>        let artistName:String = (self.musicList[playAry[playNum]].artistName)<br>        let albumImage:String = (self.musicList[playAry[playNum]].previewName)<br>        var nowPlayingInfo = [String : Any]()<br>        nowPlayingInfo[MPMediaItemPropertyTitle] = songName<br>        nowPlayingInfo[MPMediaItemPropertyAlbumTitle] = artistName<br>        <br>        if let image = UIImage(named: albumImage) {<br>            nowPlayingInfo[MPMediaItemPropertyArtwork] =<br>                MPMediaItemArtwork(boundsSize: image.size) { size in<br>                    return image<br>                }<br>        }<br>        nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = player.currentTime().seconds<br>        nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = player.currentItem?.asset.duration.seconds<br>        nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = player.rate<br>        <br>        // Set the metadata<br>        MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo<br>    }</pre><p>圖片、歌手、歌曲名稱。</p><p>建議大家參考Apple 文檔會比較不被我誤導XD</p><blockquote><strong>參考連結</strong></blockquote><ul><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/94-%E6%A8%A1%E4%BB%BF-ios-%E7%9A%84-music-app-%E8%A3%BD%E4%BD%9C%E6%83%85%E6%AD%8C%E9%BB%9E%E5%94%B1%E6%A9%9F-acacd22d8928">#94 模仿 iOS 的 Music 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%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E5%88%A9%E7%94%A8-viewdidload-%E9%BB%9E%E4%B8%80%E9%A6%96%E6%AD%8C-%E6%92%AD%E6%94%BE%E4%B8%80%E6%AC%A1pl-bfe59e9e22c">利用 AVPlayer 播放音樂音效</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/%E6%A8%A1%E4%BB%BF-ios-%E7%9A%84-music-app-%E8%A3%BD%E4%BD%9C%E5%91%A8%E8%88%88%E5%93%B2eric%E5%B0%88%E5%B1%AC%E6%92%AD%E6%94%BE%E9%9B%BB%E5%8F%B0-%E5%8C%85%E5%90%AB%E9%80%B2%E9%9A%8E%E5%8A%9F%E8%83%BD-15569fe6a13b">模仿 iOS 的 Music App 製作周興哲Eric專屬播放電台(包含進階功能）</a></li></ul><p><strong><em>背景播放</em></strong></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%A8%AD%E5%AE%9A-background-mode-%E5%9C%A8%E8%83%8C%E6%99%AF%E6%92%AD%E6%94%BE%E9%9F%B3%E6%A8%82-9bab5db75cc9">設定 Background Mode 在背景播放音樂</a></p><p><strong><em>背景控制播放</em></strong></p><p><a href="https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos/controlling_background_audio">Apple Developer Documentation</a></p><p><strong><em>AVFile格式</em></strong></p><p><a href="https://developer.apple.com/documentation/avfoundation/avfiletype">Apple Developer Documentation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff622f74ffc0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD6-2-%E6%A8%A1%E4%BB%BF-ios-%E7%9A%84-music-app-%E8%A3%BD%E4%BD%9C%E6%83%85%E6%AD%8C%E9%BB%9E%E5%94%B1%E6%A9%9F-%E5%8F%AF%E5%BF%BD%E7%95%A5%E9%80%B2%E9%9A%8E%E5%8A%9F%E8%83%BD-ff622f74ffc0">作業6-2： 模仿 iOS 的 Music 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[作業7-2：App 的解鎖畫面(passcode)]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD7-2-app-%E7%9A%84%E8%A7%A3%E9%8E%96%E7%95%AB%E9%9D%A2-passcode-1c1902f495f7?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c1902f495f7</guid>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[face-id]]></category>
            <category><![CDATA[passcode]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Sat, 25 Jul 2020 03:21:24 GMT</pubDate>
            <atom:updated>2020-08-02T14:04:01.234Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TvBSk5oGejjJbin1" /><figcaption>Photo by <a href="https://unsplash.com/@danny144?utm_source=medium&amp;utm_medium=referral">Dan Nelson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FP-z6EozoDmw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DP-z6EozoDmw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FP-z6EozoDmw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae3984664934b5b503f4abe1726a1744/href">https://medium.com/media/ae3984664934b5b503f4abe1726a1744/href</a></iframe><p><a href="https://github.com/show0007/passcode2">show0007/passcode2</a></p><p><em>更新button 用過多的action</em></p><blockquote><strong>鍵盤鎖</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*-y6dOq1ne-3JyleaVgjk9Q.png" /></figure><p>整體配置為上圖所示。</p><p>上方5個image view 拉outlet</p><p>下面12個Button 拉 Action</p><pre>//設定全域變數<strong><br>var passwordStr = &quot;1234&quot; //預設密碼</strong></pre><pre><strong>var inputPasscodeStr = &quot;&quot; //預設輸入密碼</strong></pre><p>這裡使用字串的方式來做。</p><p>然後寫幾個function來處理。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55e66765ecc4e6f0acd7f153f831a8bf/href">https://medium.com/media/55e66765ecc4e6f0acd7f153f831a8bf/href</a></iframe><p><strong>inputPasscode()</strong></p><p>給各個數字按鈕輸入的功能，</p><pre>if 0...3 ~= inputPasscodeStr.count{<br>            inputPasscodeStr += input<br>        }</pre><p>如果inputPasscodeStr<strong> </strong>的個數 介於 0 ~ 3之間，</p><p>則將改數字加入inputPasscodeStr之中。</p><pre>if inputPasscodeStr.count == 4 {<br>            if inputPasscodeStr == passwordStr{<br>                checkTrue()<br>            }else{<br>                reload()<br>                checkFalse()<br>            }<br>        }</pre><p>當輸入到第4個數的時候，</p><p>檢查inputPasscodeStr 是不是等於 passwordStr。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5236f740234894141de9d37e1f9ce22/href">https://medium.com/media/b5236f740234894141de9d37e1f9ce22/href</a></iframe><p>顯示正確或錯誤的function ，</p><p>換圖片、改背景色。</p><p>執行那4個圖片的顯示方式，</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*sunuMfMJkpk_qpufJhYrFg.png" /></figure><pre>showImage()</pre><pre>//--------//</pre><pre>//取得個數<br>let passcodeCount = inputPasscodeStr.count<br>//set image<br>let imageEmputy = UIImage(named: &quot;baaro-inWhite&quot;)<br>let imageHave = UIImage(named: &quot;baaro&quot;)</pre><p>switch 判斷 passcodeCount 個數去執行更換的圖片。</p><p>這裏我全部設定了，不知道還有沒有更好的方式。</p><pre>reload()</pre><pre>//--------//</pre><pre>func reload(){<br>        //字串清空<br>        inputPasscodeStr = &quot;&quot;<br>        //reset image為預設樣式<br>        checkImageSetDefault()<br>        //清空後 重新載入4朵雲的設定<br>        showImage()<br>    }</pre><pre>func checkImageSetDefault(){<br>        let imageDefault = UIImage(systemName: &quot;questionmark&quot;)<br>        checkImage.image = imageDefault<br>        checkImage.backgroundColor = UIColor.systemGray<br>    }</pre><blockquote><strong>Action</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d591a7dd07367d99eda4dda3beae7646/href">https://medium.com/media/d591a7dd07367d99eda4dda3beae7646/href</a></iframe><pre><a href="http://twitter.com/IBAction">@IBAction</a> func btnDelete(_ sender: UIButton) {<br>        if 1...3 ~= inputPasscodeStr.count{<br>            inputPasscodeStr.removeLast()<br>        }<br>        showImage()<br>    }</pre><p>inputPasscodeStr.removeLast()</p><p>會刪除字串inputPasscodeStr 的最後一個字。</p><blockquote><strong>FaceID</strong></blockquote><p>基本上只是照著範例加到程式裡面，</p><p>很多都還不知道意思。</p><p>加入時要記得新增faceID的權限，</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1IYsXMN-dltKSjJSmFYng.png" /></figure><p>後面的String -&gt; Value 可以設定要求權限是顯示的內容。</p><pre>self.performSegue(withIdentifier: &quot;loginSegue&quot;, sender: self)</pre><p>這裡寫在認證<strong>success </strong>裡面，</p><p>用意為認證成功時跳轉畫面。</p><p>可參考</p><p><a href="https://medium.com/@baaro.lin/swift%E7%94%A8%E7%A8%8B%E5%BC%8F%E7%A2%BC%E8%B7%B3%E8%BD%89controller-c05717865cef">SWIFT用程式碼跳轉controller</a></p><p>希望以後這部分可以全部都看得懂</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ke6wWrmXON_TFxhB" /><figcaption>Photo by <a href="https://unsplash.com/@benhershey?utm_source=medium&amp;utm_medium=referral">Ben Hershey</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote><strong>參考連結</strong></blockquote><ul><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/120-app-%E7%9A%84%E8%A7%A3%E9%8E%96%E7%95%AB%E9%9D%A2-passcode-552e9b90c97c">#120 App 的解鎖畫面(passcode)</a></li><li><a href="https://t.codebug.vip/questions-2086034.htm">如何在Swift 4中删除字元串的最後一个字元？</a></li><li><a href="https://developer.apple.com/documentation/localauthentication/logging_a_user_into_your_app_with_face_id_or_touch_id">Logging a User into Your App with Face ID or Touch ID | Apple Developer Documentation</a></li><li><a href="https://medium.com/@baaro.lin/swift%E7%94%A8%E7%A8%8B%E5%BC%8F%E7%A2%BC%E8%B7%B3%E8%BD%89controller-c05717865cef">SWIFT用程式碼跳轉controller</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c1902f495f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD7-2-app-%E7%9A%84%E8%A7%A3%E9%8E%96%E7%95%AB%E9%9D%A2-passcode-1c1902f495f7">作業7-2：App 的解鎖畫面(passcode)</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[SWIFT用程式碼跳轉controller]]></title>
            <link>https://medium.com/@baaro.lin/swift%E7%94%A8%E7%A8%8B%E5%BC%8F%E7%A2%BC%E8%B7%B3%E8%BD%89controller-c05717865cef?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/c05717865cef</guid>
            <category><![CDATA[controller]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[segue]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Sat, 25 Jul 2020 03:15:33 GMT</pubDate>
            <atom:updated>2020-07-25T03:15:33.774Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lTLDXMiVcNKwlhoK" /><figcaption>Photo by <a href="https://unsplash.com/@blakecheekk?utm_source=medium&amp;utm_medium=referral">Blake Cheek</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><a href="https://github.com/show0007/segue">show0007/segue</a></p><p>從controller拉 Segue 到另一個controller，</p><p>點選該Segue 設定identifier。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zmCP4yo_mvB6J_cO19QDxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QM9HASSUYf7bDFjKICom7A.png" /></figure><pre><strong>self.performSegue(withIdentifier: &quot;jumpSegue&quot;, sender: self)</strong></pre><p><strong>withIdentifier</strong>: 跳轉的Segue 的identifier</p><blockquote><strong>參考：</strong></blockquote><p><a href="http://tw-hkt.blogspot.com/2017/05/ios-segue.html">【iOS 中文開放式課程】Segue 切換頁面初體驗</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c05717865cef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[作業5-2：⭐️ 10YearChallenge，時間都去哪了]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD5-2-%EF%B8%8F-10yearchallenge-%E6%99%82%E9%96%93%E9%83%BD%E5%8E%BB%E5%93%AA%E4%BA%86-5a9677a1ba51?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a9677a1ba51</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[notes]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Thu, 23 Jul 2020 13:09:29 GMT</pubDate>
            <atom:updated>2020-07-24T01:37:45.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6HhdfFt9_5BbhYvP" /><figcaption>Photo by <a href="https://unsplash.com/@hngstrm?utm_source=medium&amp;utm_medium=referral">Henry &amp; Co.</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*nprU7MNSxnFBkAkeTaJDZA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*YhO_xlVcYfM-FNjK5aSxvw.gif" /></figure><p><a href="https://github.com/show0007/tenYearChallenge">show0007/tenYearChallenge</a></p><blockquote>介紹</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*q_JWfrTt7cUrvt1TBWdB2w.png" /></figure><p>我們使用到的元件如上圖。</p><blockquote><strong>Outlet</strong></blockquote><p>Image View : 更換image</p><p>Stepper : 控制value</p><p>Datepicker : 控制 Date</p><p>Slider : 控制value</p><p>Slider Label : 顯示 Slider 的Value</p><p>Datepicker Label : 顯示 Datepicker 的Date</p><blockquote><strong>Action</strong></blockquote><p>Switch : 控制timer 開關，輪播image圖片。</p><p>Stepper : 加減Slider的值</p><p>Datepicker : 依年份來換image</p><p>Slider : 依數值來換 image</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/41dc7d6da3be2866c4eb2d0925b750f6/href">https://medium.com/media/41dc7d6da3be2866c4eb2d0925b750f6/href</a></iframe><h3><strong>changeImage</strong></h3><p>changeImage 更換 image圖片的functiuon</p><p>我這邊圖片檔名為 Album0 ~ Album40</p><h3>changeSliderShowVal &amp; changeDatepickerShowVal</h3><p>更換兩個label 的顯示數值，</p><p>datepicker 方便顯示以 20XX-01-01 來做。</p><pre>String(format: “%02d”, yearNum)</pre><p>轉為字串並格式化數字為兩位數，個位數補0( 08,09,10)。</p><h3>changeDatepicker</h3><p>更改Datepicker 的日期</p><h3>changeSlider</h3><p>更改slider的數值</p><h3>changeStepper</h3><p>更改stepper的數值</p><blockquote><strong>Action</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3752cb0d4a83949446337e5f284a9dd4/href">https://medium.com/media/3752cb0d4a83949446337e5f284a9dd4/href</a></iframe><p>Slider Action 的動作：</p><p>取slider目前的值，</p><p>換圖片，改sliderLabel、Datepicker 、DatepickerLabel、stepper 的值。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1043460236f115b3e723021d99232ef0/href">https://medium.com/media/1043460236f115b3e723021d99232ef0/href</a></iframe><p>Datepicker 取得日期，</p><p>設定日期格式化的格式(參考 <strong><em>DateFormatter 格式</em></strong>)，</p><pre>let year = Int(dateFormatter.string(from: nowSelDate))  ?? 0</pre><p>dateFormatter.string(from: nowSelDate)</p><p>直接取的話，會變成(01、02、03...39、40)年，</p><p>轉Int 則會轉為數字(1、2、3...39、40)</p><p>取我們要的數字，在吧數字丟去func 處理。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a426dfa72e8c20230daf50326fd686ba/href">https://medium.com/media/a426dfa72e8c20230daf50326fd686ba/href</a></iframe><p>stepper 取數值 給各function。</p><h3>Switch</h3><p>我們要控制timer 隨著時間來更換 image。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/96dc579db60ff359b2b4b82b79d2c4f1/href">https://medium.com/media/96dc579db60ff359b2b4b82b79d2c4f1/href</a></iframe><pre>//設定全域變數<br>var timer:Timer?<br>var timeCount:Int = 0</pre><pre>self.timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(timeFunc), userInfo: nil, repeats: true) </pre><p>Timer 每秒執行一次timeFunc的function。</p><p><strong>說明：</strong></p><p>timeInterval ： 觸發間隔時間(秒)</p><p>target ： Timer觸發的對象，這邊填入<strong>self</strong>表示這一個ViewController</p><p>selector =&gt; Timer的觸發事件，需填入一個function，這邊填入<strong>timeFunc()</strong></p><p>userInfo =&gt; 可作為傳入Timer觸發事件的資料，這邊沒有則填入<strong>nil</strong></p><p>repeats =&gt; 是否重複執行(true or false)【 False 則執行一次而已】</p><p><em>Function之前的 </em><strong><em>@objc</em></strong><em> 現在不知道啥意思，所以就不誤導大家了。</em></p><p>timeFunc()主要設定當image換到最後時啟用輪播功能，</p><p>if 判斷是否到最後的image，跟數值++。</p><p>if判斷可能會有問題，也不會是最好的方法，就交給專業的優化了。</p><h3>以上</h3><blockquote><strong>參考資料</strong></blockquote><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/%E4%BE%86%E5%A0%B4%E7%92%B0%E5%B3%B6%E6%97%85%E8%A1%8C%E5%90%A7-dd32f77c9fb8">來場環島旅行吧！</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/69-10yearchallenge-%E6%99%82%E9%96%93%E9%83%BD%E5%8E%BB%E5%93%AA%E4%BA%86-5060e3fd5459">#69 10YearChallenge，時間都去哪了</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%80%8F%E9%81%8E-timer-%E8%A8%AD%E5%AE%9A%E6%AF%8F%E5%B9%BE%E7%A7%92%E9%87%8D%E8%A4%87%E5%9F%B7%E8%A1%8C-function-3c80f449107">透過 Timer 設定每幾秒重複執行 function</a></li><li><a href="https://medium.com/@mikru168/ios-timer-434d91529cdf">利用 Timer 來設定每幾秒去執行某個 function</a></li><li><a href="https://ithelp.ithome.com.tw/articles/10207707">DAY19 Timer - iT 邦幫忙::一起幫忙解決難題，拯救 IT 人的一天</a></li></ul><p><strong><em>DateFormatter 格式</em></strong></p><p><a href="https://nsdateformatter.com/">NSDateFormatter.com - Live Date Formatting Playground for Swift</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a9677a1ba51" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD5-2-%EF%B8%8F-10yearchallenge-%E6%99%82%E9%96%93%E9%83%BD%E5%8E%BB%E5%93%AA%E4%BA%86-5a9677a1ba51">作業5-2：⭐️ 10YearChallenge，時間都去哪了</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[作業5-1：⭐️ 使用 Open Peeps 圖庫開發紙娃娃 App]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD5-1-%EF%B8%8F-%E4%BD%BF%E7%94%A8-open-peeps-%E5%9C%96%E5%BA%AB%E9%96%8B%E7%99%BC%E7%B4%99%E5%A8%83%E5%A8%83-app-82dd57f9ba0e?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/82dd57f9ba0e</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Wed, 22 Jul 2020 15:23:13 GMT</pubDate>
            <atom:updated>2020-07-22T15:23:13.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*_-cvfUoJ-OltKg5TvB3NhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*BjhBueqdlrkM8upnnYNCVA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*UoVyxLjgbemvZJGwZ9BZ0g.gif" /></figure><blockquote><strong>Github</strong></blockquote><p><a href="https://github.com/show0007/paperDoll">show0007/paperDoll</a></p><p>原本是想用Container View + tableView 來顯示的，</p><p>但是拉action 時候卡住了，只好吧所有button 放同個ViewControll 。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCg_N8kzLJTcIyaAcgQnlw.png" /></figure><p>最後改成這樣</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*4MGNW6v7Doif8ItCfIvU-w.png" /></figure><p>一個畫面搞定。</p><blockquote><strong>流程</strong></blockquote><p>首先把整體人物拉好，</p><p>各物件更換試試看畫面有沒有問題。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*BRYZiugeA3mnDKHkYcDOiQ.png" /></figure><p><strong>各項目 加入outlet</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyZ2P2Sg8E5fJqXAgl1NRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jT2gSmSQXKJUI8pLvcHtrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*qTdrOQCZr63QpX3gIQcEIQ.png" /></figure><pre><a href="http://twitter.com/IBOutlet">@IBOutlet</a> var showBody: UIImageView!<br><a href="http://twitter.com/IBOutlet">@IBOutlet</a> var showHead: UIImageView!<br><a href="http://twitter.com/IBOutlet">@IBOutlet</a> var showFace: UIImageView!<br><a href="http://twitter.com/IBOutlet">@IBOutlet</a> var showAccessories: UIImageView!<br><a href="http://twitter.com/IBOutlet">@IBOutlet</a> var showBg: UIImageView!</pre><p><strong>加入Segmented Control &amp; Scroll View</strong></p><p>因為想用Segmented Control 來切換物件選項，</p><p>加入Scroll View 來取代 Table View想要的滑動效果。</p><p>切換需要把 Scroll View 加入 Outlet Collection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*iB4CxB-03-vXt0XYmjBDlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2bYONgbh7i9YpJnDtx63dw.png" /></figure><p>4個Scroll View都需要加入</p><p>可以從Connections inspector 查看是否有加入outlet or action</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*lUP0z4M9i-rAmecbihN0hw.png" /></figure><p>載入後會顯示最底下的scroll view ，可在viewDidLoad 裡先設定隱藏顯示的scroll view。</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/506e0cac1f7ce09fceb86b5ca68a63c7/href">https://medium.com/media/506e0cac1f7ce09fceb86b5ca68a63c7/href</a></iframe><p><strong>設定切換效果</strong></p><p>Segmented Control加入action</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*AMhsPziH3NsH8z1O6ZEhbA.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7eb9532efc071fd1353ecd2e87dd3f46/href">https://medium.com/media/7eb9532efc071fd1353ecd2e87dd3f46/href</a></iframe><p>這樣就有切換畫面的效果了，</p><p>雖然只是顯示隱藏而已XD</p><p><strong>Scroll View 加入Button</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*Rv238tE0VBQHjT-ZK4znMg.png" /></figure><p>再把Button 加入Action</p><p>一樣可以在Connections inspector 查看是否全都有加入了，</p><p>還不會用程式碼加入，只好土炮了。</p><p>各項目Button分開加入</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/622eea93c419b55a93c38a07246e85f7/href">https://medium.com/media/622eea93c419b55a93c38a07246e85f7/href</a></iframe><p>這樣就可以有button 換裝的效果了，</p><p>上面可以看到物件的部分image 是取BackgroundImage，</p><p>是因為，我Button顯示圖片是設定Background而已。</p><p>Image的部分可以參考 <strong>changeBackground</strong> 的部分。</p><p>因為各Button 相隔的間距太小了，導致要上下滑會不好滑動。</p><blockquote><strong>參考資料：</strong></blockquote><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/%E4%BD%BF%E7%94%A8-open-peeps-%E5%9C%96%E5%BA%AB%E9%96%8B%E7%99%BC%E7%B4%99%E5%A8%83%E5%A8%83-app-5ffec8176f95">使用 Open Peeps 圖庫開發紙娃娃 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/105-%E4%BD%BF%E7%94%A8-open-peeps-%E5%9C%96%E5%BA%AB%E9%96%8B%E7%99%BC%E7%B4%99%E5%A8%83%E5%A8%83-app-f2af2ce87f5c">#105 使用 Open Peeps 圖庫開發紙娃娃 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/xcode-hw-105-%E4%BD%BF%E7%94%A8-open-peeps-%E5%9C%96%E5%BA%AB%E9%96%8B%E7%99%BC%E7%B4%99%E5%A8%83%E5%A8%83-app-9bd7f82c69fc">[Xcode HW] #105 使用 Open Peeps 圖庫開發紙娃娃 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%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E5%88%A9%E7%94%A8%E5%A4%9A%E5%80%8B-container-view-%E5%88%87%E6%8F%9B%E9%A0%81%E9%9D%A2-6d00fe848572">利用多個 container view 切換頁面</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82dd57f9ba0e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD5-1-%EF%B8%8F-%E4%BD%BF%E7%94%A8-open-peeps-%E5%9C%96%E5%BA%AB%E9%96%8B%E7%99%BC%E7%B4%99%E5%A8%83%E5%A8%83-app-82dd57f9ba0e">作業5-1：⭐️ 使用 Open Peeps 圖庫開發紙娃娃 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[作業4:利用 UIBezierPath 實現圓環進度條，甜甜圈圖表 & 圓餅圖]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD4-%E5%88%A9%E7%94%A8-uibezierpath-%E5%AF%A6%E7%8F%BE%E5%9C%93%E7%92%B0%E9%80%B2%E5%BA%A6%E6%A2%9D-%E7%94%9C%E7%94%9C%E5%9C%88%E5%9C%96%E8%A1%A8-%E5%9C%93%E9%A4%85%E5%9C%96-5de1cd6da16d?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/5de1cd6da16d</guid>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[charts]]></category>
            <category><![CDATA[playground]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Wed, 22 Jul 2020 05:14:47 GMT</pubDate>
            <atom:updated>2020-07-22T05:14:47.288Z</atom:updated>
            <content:encoded><![CDATA[<p>USE Playground.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KiC70vEJdJogi6oA" /><figcaption>Photo by <a href="https://unsplash.com/@firmbee?utm_source=medium&amp;utm_medium=referral">William Iven</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>圓環進度條(circular progress ring)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*8ci49eBlXuUfHMkzJWMDrw.gif" /></figure><pre>import UIKit<br>let aDegree = CGFloat.pi / 180<br>let lineWidth: CGFloat = 10<br>let radius: CGFloat = 50<br>let startDegree: CGFloat = 270<br>let circlePath = UIBezierPath(ovalIn: CGRect(x: lineWidth, y: lineWidth, width: radius*2, height: radius*2))<br>let circleLayer = CAShapeLayer()<br>circleLayer.path = circlePath.cgPath<br>circleLayer.strokeColor = UIColor.gray.cgColor<br>circleLayer.lineWidth = lineWidth<br>circleLayer.fillColor = UIColor.clear.cgColor<br>let percentage: CGFloat = CGFloat.random(in: 1...100)<br>let percentagePath = UIBezierPath(arcCenter: CGPoint(x: lineWidth + radius, y: lineWidth + radius), radius: radius, startAngle: aDegree * startDegree, endAngle: aDegree * (startDegree + 360 * percentage / 100), clockwise: true)</pre><pre>let percentageLayer = CAShapeLayer()<br>percentageLayer.path = percentagePath.cgPath<br>percentageLayer.strokeColor  = UIColor(red: CGFloat.random(in: 0...1), green: CGFloat.random(in: 0...1), blue: CGFloat.random(in: 0...1), alpha: 1).cgColor<br>percentageLayer.lineWidth = lineWidth<br>percentageLayer.fillColor = UIColor.clear.cgColor<br>let label = UILabel(frame: CGRect(x: 0, y: 0, width: 2*(radius+lineWidth), height: 2*(radius+lineWidth)))<br>label.textAlignment = .center<br>label.text = String(format:&quot;%.2f %&quot;, percentage)<br>label.textColor = UIColor.white<br>let view = UIView(frame: label.frame)<br>view.layer.addSublayer(circleLayer)<br>view.layer.addSublayer(percentageLayer)<br>view.addSubview(label)<br>view</pre><blockquote>非整圈都進度條</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*-pCHVzr2Dd94J3ayWXEgcA.gif" /></figure><pre>import UIKit<br>let aDegree = CGFloat.pi / 180<br>let lineWidth: CGFloat = 10<br>let radius: CGFloat = 50<br>//設定起始結束角度<br>let startDegree: CGFloat = 150<br>let endDegree:CGFloat = 30<br>let circlePath = UIBezierPath(arcCenter: CGPoint(x: lineWidth + radius, y: lineWidth + radius), radius: radius, startAngle: aDegree * startDegree, endAngle: aDegree * endDegree, clockwise: true)<br>let circleLayer = CAShapeLayer()<br>circleLayer.path = circlePath.cgPath<br>circleLayer.strokeColor = UIColor.gray.cgColor<br>circleLayer.lineWidth = lineWidth<br>circleLayer.fillColor = UIColor.clear.cgColor<br>circleLayer.lineCap = .round<br>//數值隨機<br>let percentage: CGFloat = CGFloat.random(in: 0...100)<br>var defRedVal: CGFloat = 1<br>var defGreenVal: CGFloat = 1<br>if percentage &lt;= 50{<br>    defGreenVal -= abs(percentage-50)*2/100<br>}else{<br>    defRedVal -= abs(percentage-50)*2/100<br>}</pre><pre>//set color<br>var showColor:UIColor = UIColor(red: defRedVal, green: defGreenVal, blue: 0, alpha: 1)</pre><pre>let percentagePath = UIBezierPath(arcCenter: CGPoint(x: lineWidth + radius, y: lineWidth + radius), radius: radius, startAngle: aDegree * startDegree, endAngle: aDegree * (startDegree + 240 * percentage / 100), clockwise: true)<br>let percentageLayer = CAShapeLayer()<br>percentageLayer.path = percentagePath.cgPath<br>percentageLayer.strokeColor  = showColor.cgColor<br>percentageLayer.lineWidth = lineWidth<br>percentageLayer.fillColor = UIColor.clear.cgColor<br>percentageLayer.lineCap = .round<br>let label = UILabel(frame: CGRect(x: 0, y: 0, width: 2*(radius+lineWidth), height: 2*(radius+lineWidth)))<br>label.textAlignment = .center<br>label.text = String(format:&quot;%.2f %&quot;, percentage)<br>label.textColor = showColor</pre><pre>let view = UIView(frame: label.frame)<br>view.layer.addSublayer(circleLayer)<br>view.layer.addSublayer(percentageLayer)<br>view.addSubview(label)<br>view</pre><p>調整起始結束的數值 150~30</p><p>畫圖時的圈角度 240</p><p>留下半邊60度不顯示。</p><blockquote>甜甜圈圖表(donut chart)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*YWZA9FlHXDtQGQcZCeUclg.gif" /></figure><pre>import UIKit<br>let aDegree = CGFloat.pi / 180<br>let lineWidth: CGFloat = 50<br>let radius: CGFloat = 100<br>var startDegree: CGFloat = 270<br>let view = UIView(frame: CGRect(x: 0, y: 0, width: 2*(radius+lineWidth), height: 2*(radius+lineWidth)))<br>let center = CGPoint(x: lineWidth + radius, y: lineWidth + radius)<br>var percentages: [CGFloat] = []<br>var totalFloat:CGFloat = 100.0<br>for i in 1...3{<br>    var number:CGFloat<br>    if i==3{<br>        number = totalFloat<br>    }else{<br>        number = CGFloat.random(in: CGFloat(totalFloat/3) ... totalFloat/2)<br>    }<br>    percentages.append(number)<br>    totalFloat -= number<br>}<br>for percentage in percentages {<br>    let endDegree = startDegree + 360 * percentage / 100<br>    let percentagePath = UIBezierPath(arcCenter: center, radius: radius, startAngle: aDegree * startDegree, endAngle: aDegree * endDegree, clockwise: true)<br>    let percentageLayer = CAShapeLayer()<br>    percentageLayer.path = percentagePath.cgPath<br>    let setColor = UIColor(red: CGFloat.random(in: 0...0.7), green: CGFloat.random(in: 0...0.7), blue: CGFloat.random(in: 0...0.7), alpha: 1)<br>    percentageLayer.strokeColor  = setColor.cgColor<br>    percentageLayer.lineWidth = lineWidth<br>    percentageLayer.fillColor = UIColor.clear.cgColor<br>    view.layer.addSublayer(percentageLayer)<br>    let label = createLabel(percentage:percentage,startDegree:startDegree,setColor:setColor)<br>    view.addSubview(label)<br>    startDegree = endDegree<br>}<br>func createLabel(percentage: CGFloat, startDegree: CGFloat, setColor: UIColor) -&gt; UILabel {<br>    let textCenterDegree = startDegree + 360 * percentage / 2 / 100<br>    let textPath = UIBezierPath(arcCenter: center, radius: radius, startAngle: aDegree * textCenterDegree, endAngle: aDegree * textCenterDegree, clockwise: true)<br>    let label = UILabel(frame: CGRect(x: 0, y: 0, width: 50, height: 30))<br>    label.backgroundColor = setColor.withAlphaComponent(0.7)<br>    label.font = UIFont.systemFont(ofSize: lineWidth/2)<br>    label.text = String(format:&quot;%.2f %&quot;, percentage)<br>    label.textColor = UIColor.white<br>    label.sizeToFit()<br>    label.center = textPath.currentPoint<br>    return label<br>}<br>view</pre><blockquote>圓餅圖(pie chart)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*T6J1s44Eq3gA5EYenagLhw.gif" /></figure><pre>import UIKit<br>let aDegree = CGFloat.pi / 180<br>let radius: CGFloat = 50<br>var startDegree: CGFloat = 270<br>let view = UIView(frame: CGRect(x: 0, y: 0, width: 2*(radius), height: 2*(radius)))<br>var percentages: [CGFloat] = []<br>var totalFloat:CGFloat = 100<br>for i in 1...3{<br>    var number:CGFloat<br>    if i==3{<br>        number = totalFloat<br>    }else{<br>        number = CGFloat.random(in: CGFloat(totalFloat/3) ... totalFloat/2)<br>    }<br>    percentages.append(number)<br>    totalFloat -= number<br>}<br>let lineWidth: CGFloat = 20<br>let center = view.center<br>for percentage in percentages {<br>    let endDegree = startDegree + 360 * percentage / 100<br>    let percentagePath = UIBezierPath()<br>    percentagePath.move(to: view.center)<br>    percentagePath.addArc(withCenter: view.center, radius: radius, startAngle: aDegree * startDegree, endAngle: aDegree * endDegree, clockwise: true)<br>    let percentageLayer = CAShapeLayer()<br>    percentageLayer.path = percentagePath.cgPath<br>    let setColor = UIColor(red: CGFloat.random(in: 0...0.7), green: CGFloat.random(in: 0...0.7), blue: CGFloat.random(in: 0...0.7), alpha: 1)<br>    percentageLayer.fillColor  = setColor.cgColor<br>    view.layer.addSublayer(percentageLayer)<br>    let label = createLabel(percentage:percentage,startDegree:startDegree,setColor:setColor)<br>    view.addSubview(label)<br>    startDegree = endDegree<br>}<br>func createLabel(percentage: CGFloat, startDegree: CGFloat, setColor: UIColor) -&gt; UILabel {<br>    let textCenterDegree = startDegree + 360 * percentage / 2 / 100<br>    let textPath = UIBezierPath(arcCenter: center, radius: radius/2, startAngle: aDegree * textCenterDegree, endAngle: aDegree * textCenterDegree, clockwise: true)<br>    let label = UILabel(frame: CGRect(x: 0, y: 0, width: 50, height: 30))<br>    label.font = UIFont.systemFont(ofSize: lineWidth/2)<br>    label.text = String(format:&quot;%.2f %&quot;, percentage)<br>    label.textColor = UIColor.white<br>    label.sizeToFit()<br>    label.center = textPath.currentPoint<br>    return label<br>}<br>view</pre><p>實際上都是從大大那邊抄來的，</p><p>就加了點變化而已。</p><blockquote>參考連結</blockquote><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/%E5%88%A9%E7%94%A8-uibezierpath-%E5%AF%A6%E7%8F%BE%E5%9C%93%E7%92%B0%E9%80%B2%E5%BA%A6%E6%A2%9D-%E7%94%9C%E7%94%9C%E5%9C%88%E5%9C%96%E8%A1%A8-%E5%9C%93%E9%A4%85%E5%9C%96-6c9ac4f6ed01">利用 UIBezierPath 實現圓環進度條，甜甜圈圖表 &amp; 圓餅圖</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5de1cd6da16d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD4-%E5%88%A9%E7%94%A8-uibezierpath-%E5%AF%A6%E7%8F%BE%E5%9C%93%E7%92%B0%E9%80%B2%E5%BA%A6%E6%A2%9D-%E7%94%9C%E7%94%9C%E5%9C%88%E5%9C%96%E8%A1%A8-%E5%9C%93%E9%A4%85%E5%9C%96-5de1cd6da16d">作業4:利用 UIBezierPath 實現圓環進度條，甜甜圈圖表 &amp; 圓餅圖</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[作業3–1：⭐️⭐️ Storyboard 電子書 App，搭配 tab bar controller，table controller，navigation controller]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD3-1-%EF%B8%8F-%EF%B8%8F-storyboard-%E9%9B%BB%E5%AD%90%E6%9B%B8-app-%E6%90%AD%E9%85%8D-tab-bar-controller-table-controller-navigation-controller-fa2e220e64fb?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa2e220e64fb</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Sun, 19 Jul 2020 09:00:52 GMT</pubDate>
            <atom:updated>2020-07-19T09:00:52.094Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Demo</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*4ttOpi0z5D4sXUMOroaMsg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*sk-pRwlbxjriRMJphZyz_w.gif" /><figcaption>Default and Dark mode</figcaption></figure><blockquote><strong>Github</strong></blockquote><p><a href="https://github.com/show0007/musicDemo">show0007/musicDemo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9hehlKKjGxvZUv4m" /><figcaption>Photo by <a href="https://unsplash.com/@maltewingen?utm_source=medium&amp;utm_medium=referral">Malte Wingen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>小弟看的書不多，只好來仿一下音樂播放的畫面了。</p><p>因為這次大部分時間都在拉ＵＩ，</p><p>而本人偏懶，就這幾個畫面吧ＸＤ。</p><p>期間有想要偷懶，想試試flow layout 的 collection view</p><p>用了半天還是一直錯誤，只好下次再試吧。</p><blockquote><strong>相關連結</strong></blockquote><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%E5%95%8F%E9%A1%8C%E8%A7%A3%E7%AD%94%E9%9B%86/%E5%88%A9%E7%94%A8-flow-layout-%E7%9A%84-collection-view-%E8%A3%BD%E4%BD%9C%E7%85%A7%E7%89%87%E7%89%86-e31dad55a7ac">利用 flow layout 的 collection view 製作照片牆</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/storyboard-%E9%9B%BB%E5%AD%90%E6%9B%B8-app-%E6%90%AD%E9%85%8D-tab-controller-table-controller-navigation-controller-%E5%BD%BC%E5%BE%97%E6%BD%98%E7%9A%84-ios-app-%E4%BD%9C%E6%A5%AD-aaa7e5f9165e">#24 Storyboard 電子書 App</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa2e220e64fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD3-1-%EF%B8%8F-%EF%B8%8F-storyboard-%E9%9B%BB%E5%AD%90%E6%9B%B8-app-%E6%90%AD%E9%85%8D-tab-bar-controller-table-controller-navigation-controller-fa2e220e64fb">作業3–1：⭐️⭐️ Storyboard 電子書 App，搭配 tab bar controller，table controller，navigation controller</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[作業二：研究顯示文字的 UILabel]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD%E4%BA%8C-%E7%A0%94%E7%A9%B6%E9%A1%AF%E7%A4%BA%E6%96%87%E5%AD%97%E7%9A%84-uilabel-22fc466b44ac?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/22fc466b44ac</guid>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[labels]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Tue, 14 Jul 2020 14:11:20 GMT</pubDate>
            <atom:updated>2020-07-14T14:28:44.413Z</atom:updated>
            <content:encoded><![CDATA[<p>作業二：研究顯示文字的 UILabel</p><blockquote><strong>Line Breaks</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*phB525EmRGypLJ3v53QUOg.png" /></figure><ol><li><strong>Clip</strong>：直接切斷文字</li><li><strong>Character Warp</strong>：以字元換行顯示(顯示行數2以上)</li><li><strong>Word Warp</strong>：以詞換行顯示(顯示行數2以上)</li><li><strong>Truncate Head</strong>：去頭顯示。以……方式省略，顯示尾部文字内容。(若行數2以上，則以最後一行為主)</li><li><strong>Truncate Middle</strong>：去中段顯示。以……方式省略，顯示頭尾部份文字内容。(若行數2以上，則以最後一行為主)</li><li><strong>Truncate Tail</strong>：去尾顯示。以……方式省略，顯示頭部文字内容。(若行數2以上，則以最後一行為主)</li></ol><blockquote><strong>Autoshrink</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*BsU3GCGxXMGuSlxEvvxXtA.png" /></figure><p><strong>Fixed Font Size(default)</strong>：文字不進行縮放</p><p><strong>Minimum Font Scale</strong>：當字串太長時，依設定的最小倍率縮小文字。直到字串全部顯示或倍率無法再更小。</p><p><strong>Minium Font Size</strong>：當字串太長時，依設定的最小字型大小縮小文字，直到字串全部顯示或倍率無法再更小。</p><blockquote><strong>Shadow (文字的陰影）</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*O5OXUDPYb0CO7CGIYCZE5A.png" /></figure><p><strong>Shadow</strong>：設定陰影顏色</p><p><strong>Shadow Offset</strong>：調整陰影方向</p><p><a href="https://github.com/show0007/tabBarDemo">show0007/tabBarDemo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22fc466b44ac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD%E4%BA%8C-%E7%A0%94%E7%A9%B6%E9%A1%AF%E7%A4%BA%E6%96%87%E5%AD%97%E7%9A%84-uilabel-22fc466b44ac">作業二：研究顯示文字的 UILabel</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[作業2-1：⭐️ 實現水平捲動，上下捲動和分頁的 scroll view]]></title>
            <link>https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD2-1-%EF%B8%8F-%E5%AF%A6%E7%8F%BE%E6%B0%B4%E5%B9%B3%E6%8D%B2%E5%8B%95-%E4%B8%8A%E4%B8%8B%E6%8D%B2%E5%8B%95%E5%92%8C%E5%88%86%E9%A0%81%E7%9A%84-scroll-view-b7efbda7ed9a?source=rss-d0b28dfee9ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7efbda7ed9a</guid>
            <category><![CDATA[scrollview]]></category>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Baaro]]></dc:creator>
            <pubDate>Tue, 14 Jul 2020 13:03:06 GMT</pubDate>
            <atom:updated>2020-07-16T10:08:53.376Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>實作效果</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*p6nIsZLwYz6wbHM9i6cJCQ.gif" /></figure><blockquote><strong>Github</strong></blockquote><p><a href="https://github.com/show0007/tabBarDemo">show0007/tabBarDemo</a></p><blockquote><strong>操作說明</strong></blockquote><p>先將Scroll View 加入到畫面中</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-OsylJY_Xa9q2qv2lwuUA.png" /></figure><p>要讓scroll View 先是圖片或任何東西，需在裡面加入View才能夠顯示其內容，若直接將View 拖拉至Scroll View 中會導致能編輯畫面過小，若需要拖拉的設定、會變得非常不好編輯，建議先將View 拉致外層，方便調整畫面。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lf_BUJDg84V6xkqeKHzaFA.png" /></figure><p>會像上圖一樣，額外多出一個View 的視窗。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LsvjWE14B1AAwsQdGIsz9w.png" /></figure><p>View 設定好之後就可以把整個View 拉到Scroll View 裡面了。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*-ocqMLWayNAU69X8RBYNCw.gif" /></figure><p>拖入後座標軸沒意外都會跑掉，把座標重新指到(0,0)，即可正常顯示。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*FFkHzNzNPcTSBYAq3w6Pbw.png" /></figure><p>這時 Scroll View 將會顯示您剛剛View 的內容 ，但是還是無法進行拖拉，此時必須要去 Scroll View加入參數？才行</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*U7cd1YjLxgiKcpx3HitGbw.png" /></figure><p><strong>Key path :<em> contentSize</em></strong></p><p><strong>Type</strong> : <strong><em>Size</em></strong></p><p><strong>Value :</strong>打上您要讓他位移的範圍 {x ,y}<br>x:寬 y:高<br>設與View 同寬或同高即可</p><p>左右拉則設定x<br>上下拉則設定y<br>如果要上下左右都可以拉則x, y 的需設定。</p><blockquote><strong>補充</strong></blockquote><p>如果想要讓他一開始就讓他捲到你指定的位置的話，<br>可以加入參數 <strong><em>contentOffset Point {x, y}。</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*pI04gP8JSCy7PiHZhsIjOw.png" /></figure><p>這樣您一啟動，Scroll View 將會自動捲到您指定的座標上。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*PBhijkUqrpZ6eRkd2RlOQg.gif" /></figure><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/%E5%9C%A8-storyboard-%E8%A8%AD%E5%AE%9A-content-size-%E5%AF%A6%E7%8F%BE%E6%B0%B4%E5%B9%B3%E6%8D%B2%E5%8B%95%E7%9A%84-scroll-view-2710fa247293">設定 content size，實現水平捲動，上下捲動和分頁的 scroll view</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7efbda7ed9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/peter-pan-swift-ios-class/%E4%BD%9C%E6%A5%AD2-1-%EF%B8%8F-%E5%AF%A6%E7%8F%BE%E6%B0%B4%E5%B9%B3%E6%8D%B2%E5%8B%95-%E4%B8%8A%E4%B8%8B%E6%8D%B2%E5%8B%95%E5%92%8C%E5%88%86%E9%A0%81%E7%9A%84-scroll-view-b7efbda7ed9a">作業2-1：⭐️ 實現水平捲動，上下捲動和分頁的 scroll view</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>