跳到主要內容

發表文章

目前顯示的是 6月, 2017的文章

ios App專案追蹤

6/29 聯絡人collection有問題,花了整天找到用tableview的方法 let contactStore = CNContactStore()         //var results: [CNContact] = []         do {             try contactStore.enumerateContacts(with: CNContactFetchRequest(keysToFetch: [CNContactGivenNameKey as CNKeyDescriptor, CNContactFamilyNameKey as CNKeyDescriptor, CNContactMiddleNameKey as CNKeyDescriptor, CNContactEmailAddressesKey as CNKeyDescriptor,CNContactPhoneNumbersKey as CNKeyDescriptor])) {                 (contact, cursor) -> Void in                 self.results.append(contact)             }         }         catch{             print("Handle the error please")         } 6/28 畫完launch Screen算是開始先做一些功能 首先先從聯絡人清單下手,要拉出來顯示在自己的元件上目前還有問題 使用的framework...

hackingwithswift p5 scramble words

閉包 func promptForAnswer ( ) { let ac = UIAlertController ( title : "Enter answer" , message : nil , preferredStyle : . alert ) ac . addTextField ( ) let submitAction = UIAlertAction ( title : "Submit" , style : . default ) { [ unowned self , ac ] ( action : UIAlertAction ) in let answer = ac . textFields ! [ 0 ] self . submit ( answer : answer . text ! ) } ac . addAction ( submitAction ) present ( ac , animated : true ) }

hackingwithswift p4 webview

webView.navigationDelegate = self 一開始卡在這,怎麼叫都叫不出Navigator,後來才想到應該是要在Storyboard加上去... 比較重要的地方在於加上 webView.addObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress), options: .new, context: nil) webView的應用

hackingwithswift p3 social media

延續p1的專案 延續使用navigator controller import Social viewDidload()內 navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(shareTapped)) func shareTapped() { //let vc = UIActivityViewController(activityItems: [imageView.image!], //applicationActivities: []) //vc.popoverPresentationController?.barButtonItem = navigationItem.rightBarButtonItem //present(vc, animated: true) if let vc = SLComposeViewController(forServiceType: SLServiceTypeFacebook) { vc.setInitialText("媽我在這發文了") vc.add(imageView.image!) vc.add(URL(string: " http://www.photolib.noaa.gov/nssl ")) present(vc, animated: true) }

hackingwithswift p2 guess the flag實作

一開始先Auto layout 三個按鈕 1x 2x 3x的img set 說明 set @IBOutlet change the border width and color import GameplayKit countries = GKRandomSource . sharedRandom ( ) . arrayByShufflingObjects ( in : countries ) as ! [ String ] correctAnswer = GKRandomSource . sharedRandom ( ) . nextInt ( upperBound : 3 ) 重要    三個Btn需call同一個@IBAction並設Btn的tag 0 , 1 , 2 @IBAction func buttonTapped ( _ sender : UIButton ) { }

HackingWithSwift p1 storm viewer實作

https://www.hackingwithswift.com/read/1/0/introduction 把原本Storyboard上的ViewController砍掉 拉進Navigator Controller及tableview controller 這邊很重要卻草草帶過,感覺有刻意藏步... 卡在table裡面的table view cell identifier要在cell的attribute inspector改 找了很久看影片才找到...文件裡也沒清楚說明 大概是卡在這兩個地方,其他沒什麼大問題..