目前分類:iOS for swift (6)

瀏覽方式: 標題列表 簡短摘要

今天在整理專案的時候,無意間看見有一個案子使用了xxx.bundle 的方式,來放專案中用到的圖片檔,由於平常都習慣直接放直接用,倒是第一次看到這種用法。

所以就學習了一下如何建立這個檔案

文章標籤

cwa1022 發表在 痞客邦 留言(0) 人氣()

剛好遇到有客戶  對應的版本是從 iOS7 開始  但是AlertView 的用法真的是天差地遠啊
                  if #available(iOS 8.0, *) 
                  {//版本是iOS 8.0 以上
                    let alertController = UIAlertController(title: "", message: "", preferredStyle: .Alert)

                    let sendAction = UIAlertAction(title: "OK", style: .Default)
                    { (_) in
                         // 這個按鈕按下去要做的事情
                    }
                    
                    let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel)
                    { (_) in
                         // 這個按鈕按下去要做的事情
                    }
                    
                    alertController.addTextFieldWithConfigurationHandler
                    { (textField) in
                         //增加一個文字輸入框
                         textField.text = ""//設定輸入框的內容
                    }
                    
                    alertController.addAction(cancelAction)//加按鈕
                    alertController.addAction(sendAction)//加按鈕
                    self.presentViewController(alertController, animated: true, completion: nil)
                    
                }
                else 
                {//版本是iOS7

                    let alertView = UIAlertView(title: "", message: "", delegate: self, cancelButtonTitle: "OK", otherButtonTitles: "Cancel")
                     //記得增加  UIAlertViewDelegate 在class 上面
                    //按鈕按下去的處理就要由 下面這個func 處理
                    //func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int)                
                    alertView.alertViewStyle = UIAlertViewStyle.PlainTextInput
                    alertView.tag = self.renamealert
                    self.renameAlertTextInput = alertView.textFieldAtIndex(0)
                    self.renameAlertTextInput.text = ""
                    alertView.show()
                    
                }

            }
        }


cwa1022 發表在 痞客邦 留言(0) 人氣()

到專案設定的build settings 

搜尋關鍵字: bitcode

文章標籤

cwa1022 發表在 痞客邦 留言(0) 人氣()

請直接複製貼上享用 使用的是swift 語法 有objc需求請自己轉objc 或等我更新

 

文章標籤

cwa1022 發表在 痞客邦 留言(0) 人氣()

最近用的專案有使用到  特此分享出來

因為apple 實在是把wifi 的權限搞得太死了

文章標籤

cwa1022 發表在 痞客邦 留言(0) 人氣()

 簡單做了一個swift 使用pickerView功能的範例

必須具備知識

文章標籤

cwa1022 發表在 痞客邦 留言(0) 人氣()