備忘錄集合

//        func touchesBegan(touches: Set<UITouch>, withEvent: UIEvent?) {
//            if self.target == nil {
//                return
//            }

像重寫方法這種 把這個(gè)方法寫在另外一個(gè)方法里就會(huì)沒(méi)有重寫

寫代碼的時(shí)候注意層級(jí)關(guān)系



    func addTarget(target:AnyObject?,action: Selector){
        self.target = target
        self.action = action
    }
    
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        if self.target == nil {
            
            return
        }
        
        //判斷self.target是否實(shí)現(xiàn)了指定的方法
        if self.target!.respondsToSelector(self.action!) {
            
        self.target?.performSelector(self.action!, withObject: self)
            
            
        }else{
        
            print("按鈕點(diǎn)擊對(duì)應(yīng)的方法沒(méi)有實(shí)現(xiàn)")
        }
        
        
        
    }



懶加載
 

    lazy var imageArray: [UIImage] = {

            var tempArray = [UIImage]()

        for item in 1...15 {

            

            let image = UIImage.init(named: "32_\(item).jpg")

            tempArray.append(image!)

        }

        return tempArray

    }()



func btnAction(btn:YTButton) {
        
        let detail = DetailViewController()
        //傳值
        detail.imageArray = self.imageArray
        
        //!!!在詳情頁(yè)隱藏底部的標(biāo)簽欄
        detail.hidesBottomBarWhenPushed = true
        
        //跳轉(zhuǎn)
        self.navigationController?.pushViewController(detail, animated: true)
        
    }

類前面加static  要用類名才能調(diào)用 (類型方法)

 let str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

        let c = str.characters[str.startIndex.advancedBy(section)]



tabBarItems 和 tabBar.Items

 //顯示箭頭

            cell?.accessoryType = .DisclosureIndicator




    //1.圖片上的按鈕被點(diǎn)擊
    func deleteAction() {
        print("刪除!!!!!")
        //將當(dāng)前圖片按鈕從界面上移除
        self.removeFromSuperview()
        //發(fā)送消息通知視圖控制器刷新界面
        NSNotificationCenter.defaultCenter().postNotificationName("reloadView", object: nil)
    }

    //注冊(cè)成為觀察者
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadView", name: "reloadView", object: nil)
return 沒(méi)寫在最后  return后面的代碼會(huì)執(zhí)行



 //定制navigationBar

        //1.設(shè)置背景顏色

        self.navigationBar.barTintColor = UIColor.blackColor()

        

        //2.設(shè)置中間的文字顏色

        //NSForegroundColorAttributeName 文字顏色的key

        self.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]

        

        //3.設(shè)置填充顏色

        self.navigationBar.tintColor = UIColor.whiteColor()



 //設(shè)置狀態(tài)欄的顏色為白色
        UIApplication.sharedApplication().statusBarStyle = .LightContent



//        設(shè)置背景圖片
//        以圖片路徑的方式獲取圖片
        bgImgView =  UIImageView.init(frame: self.view.bounds)
        bgImgView.image = UIImage.init(contentsOfFile: NSBundle.mainBundle().pathForResource(bgImgName, ofType: nil)!)





//        設(shè)置中間segement
        let segement = UISegmentedControl.init(items: ["消息","電話"])
        segement.frame = CGRectMake(0, 0, 100, 40)
        segement.selectedSegmentIndex = 0
//        設(shè)置segement邊框顏色
        segement.layer.borderColor = UIColor.whiteColor().CGColor
        segement.layer.borderWidth = 1
//        設(shè)置segement背景顏色
//        segement.backgroundColor = UIColor.whiteColor()
        segement.tintColor = UIColor.whiteColor()
        
        
        self.navigationItem.titleView = segement



按鈕切圓

 //切圓
        self.centerBtn.layer.masksToBounds = true
        self.centerBtn.layer.cornerRadius = 50



textField的左右視圖

let leftImageView1 = UIImageView.init(frame: CGRectMake(0, 0, 40, 50))
        leftImageView1.contentMode = .Center
        leftImageView1.image = UIImage.init(named: "user")
        userField.leftView = leftImageView1
        userField.leftViewMode = .Always
        self.bgView.addSubview(userField)
        userField.delegate = self



 override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
//        self.outHandAnimation()
        self.view.endEditing(true)
    }


//MARK: - 監(jiān)聽(tīng)鍵盤的彈起和收起
extension LoginViewController{
    
    func addObserverAction() {
        
        //當(dāng)鍵盤彈起和收起的時(shí)候,系統(tǒng)會(huì)自動(dòng)通過(guò)消息中心去發(fā)送相應(yīng)的消息。
        //UIKeyboardWillShowNotification -> 鍵盤將要彈起對(duì)應(yīng)的消息名
        //UIKeyboardWillHideNotification -> 鍵盤將要收起對(duì)應(yīng)的消息名
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "showKeyBoard:", name: UIKeyboardWillShowNotification, object: nil)
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "hideKeyBoard:", name: UIKeyboardWillHideNotification, object: nil)
    }
    
    //鍵盤彈起
    func showKeyBoard(nof:NSNotification){
        
        
        UIView.animateWithDuration(0.4) {
            
            self.bgView.transform = CGAffineTransformMakeTranslation(0, -110)
        }
        
    }
    
    //鍵盤收起
    func hideKeyBoard(nof:NSNotification) {
        
        UIView.animateWithDuration(0.4) {
            
            self.bgView.transform = CGAffineTransformMakeTranslation(0, 0)
        }
        
    }



 
        let story = UIStoryboard.init(name: "Register", bundle: nil)
        let register = story.instantiateInitialViewController()
        self.navigationController?.pushViewController(register!, animated: true)


訊飛語(yǔ)音開(kāi)放平臺(tái)







 //self.imgView = UIImageView.init(image: UIImage.init(data: (data?.picData)!))

           self.imgView.image = UIImage.init(data: (data?.picData)!)//將不是YTTabBar的從系統(tǒng)的tabBar上移除

            item.removeFromSuperview()



App Transport Security Settings



 //獲取最外層的字典
            let json = data.result.value
            
            //獲取articles對(duì)應(yīng)的數(shù)組
             let tarray = json?.objectForKey("articles”)



 //耗時(shí)操作執(zhí)行完成后將子線程取消
        NSThread.currentThread().cancel()



  //- 方式3:隱式的創(chuàng)建一個(gè)子線程
    func creatThread3() {
        //1.創(chuàng)建一個(gè)后臺(tái)線程(子線程),創(chuàng)建好之后會(huì)自動(dòng)啟動(dòng)
        self.performSelectorInBackground("longTimeOperation", withObject: nil)
    }

//!!!圖片下載完成后回到主線程去展示圖片
        //參數(shù)1:指定的方法
        //參數(shù)2:指定的線程
        //參數(shù)3:方法中的實(shí)參
        //參數(shù)4:是否等待指定的方法執(zhí)行完成
        //功能:在指定的線程中調(diào)用指定的方法
        self.performSelector("showImage:", onThread: NSThread.mainThread(), withObject: image, waitUntilDone: false)



//MARK: - 兩個(gè)概念:
//1.任務(wù): 想要執(zhí)行的操作(想要做的事情)
//2.隊(duì)列: 用來(lái)存儲(chǔ)任務(wù)的容器(先進(jìn)先出)

//GCD的使用步驟:
//1.創(chuàng)建隊(duì)列(需要確定隊(duì)列的類型)
//2.創(chuàng)建任務(wù),并且將任務(wù)添加到隊(duì)列中.(確定任務(wù)的執(zhí)行方式)
//GCD會(huì)自動(dòng)將任務(wù)從隊(duì)列中取出,放到對(duì)應(yīng)的線程中去執(zhí)行

//MARK: - 四個(gè)術(shù)語(yǔ)
//任務(wù)的執(zhí)行方式:
//1.同步:在當(dāng)前線程中執(zhí)行(不會(huì)去創(chuàng)建新的線程),需要馬上執(zhí)行任務(wù)
//2.異步:在另外一個(gè)線程中執(zhí)行(會(huì)創(chuàng)建新的線程)

//隊(duì)列的類型:
//1.并發(fā):隊(duì)列中的任務(wù)可以同時(shí)執(zhí)行(前提是能有多個(gè)線程)
//2.串行:隊(duì)列中的任務(wù)一個(gè)一個(gè)順序執(zhí)行

//在swift中使用OC的第三方庫(kù)
//1.將第三方庫(kù)的文件拖到工程中
//2.創(chuàng)建橋接文件
//a.通過(guò)新建文件創(chuàng)建一個(gè).h文件,命名規(guī)范:XXX-Briding-Header
//b.在橋接文件中將需要使用的頭文件通過(guò)"#import"包含進(jìn)去
//c.設(shè)置工程文件



SDWebImage的使用  //通過(guò)SDWebImage做圖片的異步下載和緩存

        //參數(shù)1:圖片的網(wǎng)路路徑對(duì)應(yīng)的url

        //參數(shù)2:占位圖

        //cell.iconImageView.setImageWithURL(NSURL.init(string: model.icon), placeholderImage: UIImage.init(named: "user_default"))

        cell.iconImageView.sd_setImageWithURL(NSURL.init(string: model.icon), placeholderImage: UIImage.init(named: "user_default"))
<key>NSAppTransportSecurity</key>

<dict>

<key>NSAllowsArbitraryLoads</key>

<true/>

</dict>



NSFileManager這個(gè)類



do { } catch { } 捕獲異常

caemitterlayer類

判斷一個(gè)類的對(duì)象判斷,,,可以通過(guò)它的屬性判斷,,還可以給它添加其它的屬性用來(lái)區(qū)分如tag值





請(qǐng)求網(wǎng)絡(luò)數(shù)據(jù)提問(wèn)

注意我們創(chuàng)建connection和session會(huì)話都是調(diào)用的方法創(chuàng)建的而不是直接初始化

1.NSURLConnetion方式請(qǐng)求數(shù)據(jù)(ios9已經(jīng)被廢除)(只是簡(jiǎn)單介紹了下沒(méi)有涉及get 。post等傳參數(shù)問(wèn)題)

直接用這個(gè)類的方法而不是用對(duì)象的方法?用的方法的名稱是什么?帶了幾個(gè)參數(shù)?最后一個(gè)參數(shù)中閉包有哪幾個(gè)參數(shù)?如何將二進(jìn)制數(shù)據(jù)解析成json數(shù)據(jù),調(diào)用的是那個(gè)類的什么方法而不是對(duì)象的方法?

2.NSURLSession.sharedSession()這個(gè)方法快速創(chuàng)建的是默認(rèn)的會(huì)話?還有一個(gè)方法創(chuàng)建默認(rèn)會(huì)話模式 哪個(gè)方法?請(qǐng)求對(duì)象任務(wù)的執(zhí)行語(yǔ)句?

創(chuàng)建POST請(qǐng)求對(duì)象是用的哪個(gè)類?NSMutableURLRequest.init(URL: url!)

//b.將字符串轉(zhuǎn)換成二進(jìn)制
        let sendData = sendStr.dataUsingEncoding(NSUTF8StringEncoding)



//3.根據(jù)會(huì)話模式創(chuàng)建session(創(chuàng)建默認(rèn)會(huì)話模式的session)
        //let session = NSURLSession.init(configuration: NSURLSessionConfiguration.defaultSessionConfiguration())
        //快速創(chuàng)建一個(gè)默認(rèn)會(huì)話模式的session
        let session = NSURLSession.sharedSession()


  
        //!!!圖片下載完成后回到主線程去展示圖片
        //參數(shù)1:指定的方法
        //參數(shù)2:指定的線程
        //參數(shù)3:方法中的實(shí)參
        //參數(shù)4:是否等待指定的方法執(zhí)行完成
        //功能:在指定的線程中調(diào)用指定的方法
        self.performSelector("showImage:", onThread: NSThread.mainThread(), withObject: image, waitUntilDone: false)



單例的創(chuàng)建方式



import UIKit

class ValueManager: NSObject {
    
//    保證當(dāng)前這個(gè)類只能創(chuàng)建出一個(gè)對(duì)象,而且這個(gè)對(duì)象必須defalutManager去拿到
//    拿到當(dāng)前這個(gè)類唯一的對(duì)象
    static let defalutManager = ValueManager()
    
//    構(gòu)造方法私有化
    private override init() {
        
    }
    
//    2.聲明一個(gè)屬性的類型是需要傳的值的類型
    var sendValue = ""
}



 //self.imgView = UIImageView.init(image: UIImage.init(data: (data?.picData)!))

           self.imgView.image = UIImage.init(data: (data?.picData)!)//將不是YTTabBar的從系統(tǒng)的tabBar上移除

            item.removeFromSuperview()
 

        //設(shè)置每個(gè)cell之間的最小間距(行間距和列間距)

        layout.minimumInteritemSpacing = 0

        layout.minimumLineSpacing = 0 //設(shè)置這個(gè)屬性就是直接設(shè)置了每一行cell之間的間距



tableView   collectionView 設(shè)置cell,foot,header一般是在創(chuàng)建這三個(gè)對(duì)象的時(shí)候就就改變frame和內(nèi)容



UITableViewCell中有兩個(gè)header  1.是textLabel    2.detailTextLabel

 //5.
    func sectionIndexTitlesForTableView(tableView: UITableView) -> [String]? {
        return ["A","B","C","D","E"]
    }

 
 //數(shù)據(jù)源數(shù)組
    lazy var dataArray: [NSDictionary] = {
       
        var tempArray = [NSDictionary]()
        
        //1.獲取plist文件的路徑
        let path = NSBundle.mainBundle().pathForResource("data2.plist", ofType: nil)
        //2.拿到plist文件最外層的數(shù)組
        //將plist文件轉(zhuǎn)換成OC的數(shù)組(前提是plist的最外層是數(shù)組)
        //參數(shù):plist文件的路徑
        let plistArray = NSArray.init(contentsOfFile: path!)
        
        return tempArray
    }()


//CGSizeMake(1000,100)是最大值
let nameSize = nameStr.boundingRectWithSize(CGSizeMake(1000,100),options: .USesLineFramentOrigin,attributes:[NSFontAttributeName: UIFont.systemFontOfSize(13)],context:nil).size



  //設(shè)置title和image

        for (i,value) in self.tabBar.items!.enumerate() {

            value.title = titleArray[i]

            //item字體相關(guān),字體是一個(gè)title一個(gè)tile設(shè)置的要用循環(huán)拿到每個(gè)title

            value.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.lightGrayColor(),NSFontAttributeName: UIFont.systemFontOfSize(15)], forState: .Normal)

            在tabBar中設(shè)置title字體

            value.setTitleTextAttributes([NSFontAttributeName:UIFont.systemFontOfSize(15), NSForegroundColorAttributeName:UIColor.orangeColor()],forState: .Selected)

        }

然而在navigationBar中設(shè)置title是

 self.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]



 item.image = UIImage.init(named: imageName[i])?.imageWithRenderingMode(.AlwaysOriginal)

            item.selectedImage = UIImage.init(named: imageName[i] + "_1")?.imageWithRenderingMode(.AlwaysOriginal)





 //第一次點(diǎn)擊放大,第二次點(diǎn)擊縮小
        if self.imageView.frame.size.width == 200 {
            
            self.imageView.frame = self.view.bounds
            
        }else{
        
            self.imageView.frame = CGRectMake(0, 0, 200, 200)
            self.imageView.center = self.view.center
        }


self.center  = (touches.first?.locationInView(self.superview))!

  override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {

//      停止UIView動(dòng)畫
        
        self.imagView.layer.removeAllAnimations()
//        讓形變清空
        self.imagView.transform = CGAffineTransformIdentity
    }

 self.tabBar.translucent = false



 //2.設(shè)置中間的文字顏色
        //NSForegroundColorAttributeName 文字顏色的key
        self.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]







        
//        需要顯示在Label上的文字
        let str = "有的防護(hù)服的發(fā)揮份發(fā)動(dòng)機(jī)減肥哈將對(duì)方尷尬發(fā)動(dòng) "
       
//        計(jì)算顯示指定文字所需要的最小空間
//        1.將swift的字符串轉(zhuǎn)換成oc的字符串
        let ocStr = str as NSString
//        2.計(jì)算字符串大小
//        參數(shù)1:限制顯示當(dāng)前字符串當(dāng)前字符串的最大寬度和最大高度
//        參數(shù)2:設(shè)置渲染方式
//             (UsesLineFragmentOrigin)
//        參數(shù)3:確定文字的字體(大小)
//        NSFontAttributeName -> 字體對(duì)應(yīng)的Key值
//        NSForegrouundColorAttributeName -> 文字顏色對(duì)應(yīng)的Key值
    let strSize = ocStr.boundingRectWithSize(CGSizeMake(200, 100000), options: .UsesLineFragmentOrigin, attributes: [NSFontAttributeName: UIFont.systemFontOfSize(17)], context: nil).size
        print(strSize)
        
        
//        創(chuàng)建label顯示文字
        let label = UILabel.init(frame: CGRectMake(100, 100, strSize.width, strSize.height))
        label.backgroundColor = UIColor.yellowColor()
        self.view.addSubview(label)
        label.text = str
//        自動(dòng)換行
        label.numberOfLines = 0  //必須要自動(dòng)換行,不然會(huì)一行顯示
    }

     board = [[PointState]](count: 15, repeatedValue: [PointState](count: 15, repeatedValue: .Space))







//
//  TapViewController.swift
//  02-手勢(shì)集合
//
//  Created by 千鋒1 on 16/9/2.
//  Copyright ? 2016年 1000phone. All rights reserved.
//

import UIKit

class TapViewController: YTViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

//        1.創(chuàng)建點(diǎn)擊手勢(shì)對(duì)象
//        UIGestureRecongnizer是所有手勢(shì)的父類
//        參數(shù)1.調(diào)用方法的對(duì)象
//        參數(shù)2.方法對(duì)應(yīng)的選擇器 -> 這個(gè)方法如果帶參只能帶一個(gè)參數(shù),參數(shù)的對(duì)象就是當(dāng)前創(chuàng)建的點(diǎn)擊手勢(shì)對(duì)象
//        點(diǎn)擊手勢(shì)發(fā)生的時(shí)候讓參數(shù)1調(diào)用參數(shù)2中的方法
    
        let tap = UITapGestureRecognizer.init(target: self, action: "tapActon:")
        
        //核心屬性:點(diǎn)擊次數(shù)(默認(rèn)是1->單擊)
        tap.numberOfTapsRequired = 2
        
//        2.將點(diǎn)擊手勢(shì)添加到視圖上(要求:添加手勢(shì)的視圖必須可以進(jìn)行用戶交互)
        self.view.addGestureRecognizer(tap)
        
//        3.打開(kāi)圖片的用戶交互,并添加點(diǎn)擊手勢(shì)
//        注意:同一個(gè)手勢(shì)對(duì)象,只能被添加到一個(gè)視圖
        self.imagView.addGestureRecognizer(tap)
    }
    
    
    
    
    func tapAction(tap:UITapGestureRecognizer) {
        
        print("點(diǎn)擊")
        
        if self.imagView.frame.size.width == 200 {
            self.imagView.frame = self.view.bounds
    
        }
        else {
            self.imagView.frame = CGRectMake(0, 0, 200, 200)
            self.imagView.center = self.view.center
        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
       
    }
    
}


// 將數(shù)據(jù)保存到手機(jī)硬盤中 -> 數(shù)據(jù)本地化

// ios中的數(shù)據(jù)本地化

// 1.文件操作(NSFileManager和NSFileHandle)

// 2.plist文件(NSUserDefaults)

// 3.數(shù)據(jù)庫(kù)

// 4.歸檔和解歸檔

// ios應(yīng)用程序中的本地路徑 -> 沙盒路徑
// 蘋果手機(jī)安裝的每個(gè)應(yīng)用程序都有一個(gè)專門的內(nèi)存空間用來(lái)存儲(chǔ)當(dāng)前應(yīng)用程序中產(chǎn)生的本地?cái)?shù)據(jù) ,這個(gè)內(nèi)容空間就是沙盒。每個(gè)應(yīng)用程序?qū)?yīng)的沙盒是獨(dú)立的,相互不影響,而且相互不能訪問(wèn)。



 // =============沙盒===============
        //!!!面試常問(wèn)
        // 1.拿到沙盒路徑
        // 如果應(yīng)用程序是在真機(jī)上,拿到的就是真機(jī)的沙盒目錄,如果是在模擬器上可以拿到模擬器對(duì)應(yīng)的沙盒目錄
        // a.Documents:存到這個(gè)目錄下的數(shù)據(jù)除非講應(yīng)用程序卸載,否則里面的數(shù)據(jù)會(huì)自動(dòng)銷毀
        let documentPath = NSHomeDirectory() + "/Douments"
        // b.Library:在程序更新的時(shí)候,數(shù)據(jù)會(huì)自動(dòng)被刪除
        // Caches:專門用來(lái)存儲(chǔ)緩存數(shù)據(jù) 在清除緩存的時(shí)候就將這個(gè)文件夾的內(nèi)容刪除
        let cachesPath = NSHomeDirectory() + "/Library/Caches"
        // Preferences:(偏好設(shè)置)專門用來(lái)存儲(chǔ)設(shè)置性的數(shù)據(jù)
        let prefencesPath = NSHomeDirectory() + "/Library/Preferences"
        // temp:存到這個(gè)目錄下的數(shù)據(jù)在程序結(jié)束后會(huì)自動(dòng)銷毀
        let temp = NSHomeDirectory() + "/temp"
        print(NSHomeDirectory())



command + shirft+ g

顯示隱藏文件

iTunes在與iPhone同步時(shí),備份所有的Documents和Library文件。
iPhone在重啟時(shí),會(huì)丟棄所有的tmp文件。


查看方法:
方法1、可以設(shè)置顯示隱藏文件,然后在Finder下直接打開(kāi)。設(shè)置查看隱藏文件的方法如下:打開(kāi)終端,輸入命名
(1)顯示Mac隱藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -bool true
(2)隱藏Mac隱藏文件的命令:defaults write com.apple.finder AppleShowAllFiles -bool false
(3)輸完單擊Enter鍵,退出終端,重新啟動(dòng)Finder就可以了 重啟Finder:鼠標(biāo)單擊窗口左上角的蘋果標(biāo)志-->強(qiáng)制退出-->Finder-->
現(xiàn)在能看到資源庫(kù)文件夾了。 
打開(kāi)資源庫(kù)后找到/Application Support/iPhone Simulator/文件夾。這里面就是模擬器的各個(gè)程序的沙盒目錄了。
方法2、這種方法更方便,在Finder上點(diǎn)->前往->前往文件夾,輸入/Users/username/Library/Application Support/iPhone Simulator/  前往。
username這里寫用戶名。



 //1.設(shè)置是否透明
        self.tabBar.translucent = false

    self.view.window?.rootViewController = YTTabBarController()



 let item2 = UIBarButtonItem.init(image: UIImage.init(named: "itemImage")?.imageWithRenderingMode(.AlwaysOriginal), style: .Plain, target: self, action: "itemAction:")



//2.隱藏系統(tǒng)自帶的返回按鈕
        self.navigationItem.hidesBackButton = true





 let space1 = UIBarButtonItem.init(barButtonSystemItem: .FlexibleSpace, target: nil, action: "")
        //b.FixedSpace(相當(dāng)于空格,用來(lái)設(shè)置每個(gè)item之間的間距,間距需要手動(dòng)設(shè)置)
        let space2 = UIBarButtonItem.init(barButtonSystemItem: .FixedSpace, target: nil, action: "")
        //設(shè)置間距
        space2.width = 20
        
        
        //將item添加到toolBar上
        self.toolbarItems = [space2,item1,space2,item2,space2,item3,space2,item4,space2]



 //MARK:-警告框
    
    func showAlert(text: String,action:((UIAlertAction)-> Void)?) {
        
        //創(chuàng)建警告框
        let alert = UIAlertController.init(title: nil, message: text, preferredStyle: .Alert)
        //添加action
        let action = UIAlertAction.init(title: "確定", style: .Default,handler: action)
        alert.addAction(action)
        self.presentViewController(alert, animated: true, completion: nil)
        
    }
閉包的寫法,尾隨閉包的幾種寫法

弄清繼承關(guān)系
弄清子類特有的,就、以及哪些是父類的。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容