八月第三周

1.protocol 与 NSObjectProtocol:

继承于 class一般使用在没有继承于 NSObjectClass 中,而继承于 NSObjectProtocol一般使用于继承于 NSObjectClass 中。

2.

NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(startTimer), object: nil)

perform(#selector(startTimer), with: nil, afterDelay: 0.5)

3.如何对浮点数进行取余(取模):

使用 truncatingRemainder 方法进行浮点数取余.

4.Swift4.0 URLString内有汉字转码方法:

https://www.jianshu.com/p/bdf040d47018

5.

    func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {

        let url = request.url

        if !(url?.scheme == "http") && !(url?.scheme == "https") {

            if UIApplication.shared.canOpenURL(url!) {

                UIApplication.shared.openURL(url!)

                return false

            }

        }

        return true

    }

6.iOS 清除xcode缓存和生成文件:

https://www.jianshu.com/p/de5ae302a42a

7.查询framework的架构信息:

lipo -info xxx.framework/xxxxFramework

8.Cannot convert value of type 'String?' to closure result type '[String : Any]’:

不写明类型就行。 

https://stackoverflow.com/questions/37774822/swift-closure-cannot-convert-value-of-type-bool-to-expected-argument-t

9.最优办法查找两个数组相同与不同的数据:

https://www.jianshu.com/p/d817a3416955

10.Set的详解:

http://www.hangge.com/blog/cache/detail_1840.html

猜你喜欢

转载自www.cnblogs.com/pengsi/p/9496254.html