跳到主要內容

發表文章

目前顯示的是 8月, 2015的文章

[NOTE] Swift

if if else 判斷時,可超合 && 和 || if的()可以不需使用! 比較字串是否相等時,就是用 ==,會比較字串是否相同 若是比較字定義的物件是否相等時,要用 ===,會比較是否為同一物件   switch case 可以不用() 可以比對任何型別 每個case裡的command執行完就會自動break,所以不用每行都加break case裡不可以是空的,若一定是空的,就給他一個break 加上fallthrough可以繼續執行下一個case case可以有多個符合條件,用逗號分開(case 1,100: )   for for i in 1..3 { // 1,2 } 2015/09/12 幹,上面兩個點的已經不能用了 for i in 1..<3 { // 1,2 }   for i in 1…3 { // 1,2,3 } // 印出每個字元 var name = “ABC" for char in name { }   optional 宣告optional時,問號需跟變數型別沒有間隔 var age: Int? , 不能是 var age: Int ? 加上?後,會被自動初始化為nil //判斷optional是否有值,有值再access if let ageNumber = age { } if var ageNumber = age{ } 加上?表示為optional型別,加上!表示自動解包裝(Implicitly Unwrapped Optionals),直接從optional取值 var aa = age ?? 30 // ?? 為optional加上預設值,當nil時會用預設值。注︰??左右要有空白!!   function func eat(name:String, foodPrice price:Int) // 外部參數名稱(可省略) 內部參數名稱: 參數型別 func eat(name:String, price price:Int) // 外部參數名稱與內部參數名稱相同也可以但會有警告 func eat(name:String, #price :int) // 加上#表示會自動產生同名的外部參數名稱 fun

[NOTE] SOAP(Web Service) with Swift

Access REST Web Service with Apple’s new Swift Language http://network-development.blogspot.tw/2014/06/access-rest-web-service-with-apples-new.html         for Objective-C How to Write an iOS App That Uses a Web Service http://www.raywenderlich.com/2965/how-to-write-an-ios-app-that-uses-a-web-service

Swift Array filter

var visitors = [["age" : 22], ["age" : 41], ["age" : 23], ["age" : 30]] var filteredVisitors = visitors.filter({ $0["age"] < 30 //access the value to filter }) println(filteredVisitors)

Git ignore

所需檔案︰.gitignore 如果沒有就手動增加 在SurceTree裡也可以用設定的     內容可參考︰ Objective-C.gitignore https://github.com/github/gitignore/blob/master/Objective-C.gitignore 忽略某些文件 http://gitbook.liuhui998.com/4_1.html 在 git 中忽略文件 gitignore 与 exclude http://www.cnblogs.com/pylemon/archive/2012/07/16/2593112.html 【git】.gitignore用法 http://www.jianshu.com/p/a078cf2fd9b0   但如果已經有commit過了,後來再設會無效果 這時就得刪除已經被commit的資料 git rm --cached -r Pods/ git rm --cached -f *.xcuserstate   git忽略已经被提交的文件 http://segmentfault.com/q/1010000000430426 .gitignore - ignore any 'bin' directory http://stackoverflow.com/questions/1470572/gitignore-ignore-any-bin-directory 讓 Xcode 與 Git 合作愉快 http://iosdevelopersnote.blogspot.tw/2012/03/xcode-git.html     git 学习路线 http://blog.vichamp.com/git/2015/03/25/Guideline-to-Learn-git/ 廖雪峰官網-Git教程 http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 Podfile https://guides.cocoapods.org/using/the-podfile.html     把已建立的專案加入 Xcode 的

設定圓角及邊線

  // Drawing code self.stopButton.layer.borderWidth = 1.0; //設定邊線寬度 self.stopButton.layer.borderColor = UIColor.whiteColor().CGColor //設定邊線顏色 self.stopButton.layer.masksToBounds = true; //這行要有才能顯示出來 self.stopButton.layer.cornerRadius = 5.0; //邊角15.0f,自行設定邊角圓弧度

Git

  git 学习路线 http://blog.vichamp.com/git/2015/03/25/Guideline-to-Learn-git/   廖雪峰官網-Git教程 http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000   Podfile https://guides.cocoapods.org/using/the-podfile.html

JSON in Java

JSON java lib︰ http://json-lib.sourceforge.net/   所需的lib︰ Json-lib requires (at least) the following dependencies in your classpath: jakarta commons-lang 2.5 jakarta commons-beanutils 1.8.0 jakarta commons-collections 3.2.1 jakarta commons-logging 1.1.1 ezmorph 1.0.6   Sample︰ 專案結構︰ 範例程式︰ 輸出JSON結果︰   相關檔案︰ https://www.dropbox.com/sh/lkmopc7v4omdoro/AABQ4-X9yBxtKrvO3jxydVhQa?dl=0        

Mockup Toold - Sketch 3

  快樂版? Sketch  3.3.3  http://soft.macx.cn/soft5993.htm   Sketch 中文網  http://sketchcn.com/ Sketch App Source  http://www.sketchappsources.com/ Flat UI Kit for Sketch  http://medialoot.com/item/flat-ui-kit-for-sketch/   那些mockup沒告訴你的事@WebConf.tw 2013 http://www.slideshare.net/adamp3wang/mockupwebconftw-2013   Design & illustration http://design.tutsplus.com/categories/interface   教學︰ 玩转 Sketch 系列文章一:进入一个全新的时代  http://www.waerfa.com/sketch-skills-series-chapter-one  Learn Sketch 3 教程on Sketch 后花园 - Trello  https://trello.com/b/mZBut2Ji/sketch   資源︰ 有没有 Sketch 相关的教程或者素材下载?  http://www.zhihu.com/question/23421455   Sketch3 基礎介紹 (slideshare) http://www.slideshare.net/tpodomoto/sketch-38533185 Sketch3 基礎介紹 from Azzurro Domoto

Hide Navigation bar上的左邊item

IOS API 讓人最討厭的地方就是既然已經不能用的API幹麻不把它拿掉 一堆似是而非的method,這個不能用,那個沒效果…啃   這次的問題是要Hide Navigation bar上的左邊item   command︰ self.navigationItem.setLeftBarButtonItem(nil, animated: true)   舊的用法(已不能用了)︰ self.navigationItem.setHidesBackButton(true, animated: false)