開發(fā)周報(bào) 12月 - 1

1.UIView 封裝的動(dòng)畫Transition

UIView層 對(duì)于transition 的翻轉(zhuǎn)動(dòng)畫有2種

open class func transition(from fromView: UIView, to toView: UIView, duration: TimeInterval, options: UIViewAnimationOptions = [], completion: (@escaping (Bool) -> Swift.Void)? = nil)

這個(gè)是2個(gè)view 之間的翻轉(zhuǎn)動(dòng)畫

open class func transition(with view: UIView, duration: TimeInterval, options: UIViewAnimationOptions = [], animations: (@escaping () -> Swift.Void)?, completion: (@escaping (Bool) -> Swift.Void)? = nil)

這是單個(gè)頁面的翻轉(zhuǎn)動(dòng)畫 可用于imageView的重新賦值,新老圖片轉(zhuǎn)換有翻轉(zhuǎn)效果*****標(biāo)記一下

2.Toolbar

NavigationC 中自帶toolbar

3.Stroyboard

3.1在sb中可以拖拽預(yù)留的控件


![934EB4FA-C154-496C-BB03-D00B5F00875D.png](http://upload-images.jianshu.io/upload_images/1106106-91e1670342ab9483.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

這樣就可以在sb中初始化 但不展示在sb的VC中
這種方式 在toolbar切換item中格外好用

3.2 Embed Segue
如果在sb中實(shí)現(xiàn)parent child VC? sb中其實(shí)有一個(gè)contain view 的控件就可以實(shí)現(xiàn)父子VC的關(guān)系。連接的Segue 為embed segue

4.Progress

第一個(gè)接觸這個(gè)是在AFN中,蘋果單獨(dú)將下載任務(wù)抽象成一個(gè)類
progress在處理多任務(wù) 和 父子任務(wù) 特別方便

open var totalUnitCount: Int64 //任務(wù)總量
 open var completedUnitCount: Int64//完成的任務(wù)數(shù)
open var localizedDescription: String!//完成任務(wù)數(shù)的描述 -
open var localizedAdditionalDescription: String!
open var isCancellable: Bool //是否可取消
open var isPausable: Bool // 是否可暫停
以及對(duì)應(yīng)的處理
open var cancellationHandler: (() -> Swift.Void)?
open var pausingHandler: (() -> Swift.Void)?

//==
open var fractionCompleted: Double { get }//一半通過kvo來監(jiān)聽屬性來獲取進(jìn)度

在子線程中進(jìn)行下載任務(wù)的話,可以綁定子線程

open func becomeCurrent(withPendingUnitCount unitCount: Int64)//綁定
在其中初始化的progress 默認(rèn)子progress
open func resignCurrent()//解綁

父子progress還有其他方法

@available(iOS 9.0, *)
public /*not inherited*/ init(totalUnitCount unitCount: Int64, parent: Progress, pendingUnitCount portionOfParentTotalUnitCount: Int64)

public init(parent parentProgressOrNil: Progress?, userInfo userInfoOrNil: [AnyHashable : Any]? = nil)

@available(iOS 9.0, *)
    open func addChild(_ child: Progress, withPendingUnitCount inUnitCount: Int64)

5.dispatch 定時(shí)器

DispatchSourceTimer協(xié)議
DispatchSource類遵循上面Timer協(xié)議

//初始化
public class func makeTimerSource(flags: DispatchSource.TimerFlags = default, queue: DispatchQueue? = default) -> DispatchSourceTimer
//開始
public func scheduleRepeating(deadline: DispatchTime, interval: DispatchTimeInterval, leeway: DispatchTimeInterval = default)

之后可以可以對(duì)應(yīng)的取消暫停 都有對(duì)應(yīng)的閉包操作

6.coreImage

CIImage     //coreImage的處理單元
CIFilter      //圖片處理類
CIContext // 渲染
順序是
1 CIImage kvc 給CIFilter的“inputImage” 選擇濾鏡效果
2CIContext 根據(jù)CIFIlter的outputImage 渲染出最后的cgimage

var outputImage: UIImage?
        
if let filter = CIFilter(name: "CIPhotoEffectTransfer"), let cgImage = image.cgImage {
            let filterInput = CIImage(cgImage: cgImage)
            
            filter.setValue(filterInput, forKey: "inputImage")
            
            guard let filterOutput = filter.outputImage else { return outputImage }
            
            let context = CIContext(options: [:])
            let outputCGImage = context.createCGImage(filterOutput, from: filterOutput.extent)

            outputImage = UIImage(cgImage: outputCGImage!)
        }

http://blog.csdn.net/miracle_of_thinking/article/details/8141051

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容