macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

runLoopModesForAnimating

INDEX>AppKit>NSAnimation

アニメーションの実行ループ

解説

アニメーションの実行ループ。

設定値

Objective-C

@property(readonly, copy) NSArray *runLoopModesForAnimating

Swift

var runLoopModesForAnimating: [AnyObject]? { get }

フレームワーク

ApplicationKit

クラス

NSAnimation

使用可能

10.4

更新時のバージョン

OS X 10.10.3
Swift 1.2

例文

Objective-C

Swift 2.0

//NSAnimation runLoopModesForAnimating
    //Swift 2.0
    @IBAction func function003(sender: AnyObject) {
        //NSAnimationProgress
        var progMarks : [NSAnimationProgress] =  [
            0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5,
            0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0  ]
        var i :Int
        let count :Int = 20
        //アニメーション設定
        theAnim003 = NSAnimation(duration: 10.0, animationCurve: NSAnimationCurve.EaseInOut)
        
        theAnim003!.frameRate = 20.0
        theAnim003!.delegate = self
        theAnim003!.animationBlockingMode = NSAnimationBlockingMode.Blocking
        
        //登録
        for (i = 0 ; i<count ; i++){
            theAnim003!.addProgressMark(progMarks[i])
            NSLog("bbb %f",progMarks[i])
        }
        dispatch_async(dispatch_get_main_queue()) {
            self.theAnim003!.startAnimation()
        }
        
    }

Swift 1.2

    //NSAnimation runLoopModesForAnimating
    @IBAction func function003(sender: AnyObject) {
        //NSAnimationProgress
        var progMarks : [NSAnimationProgress] =  [
            0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5,
            0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0  ]
        var i :Int
        var count :Int = 20
        //アニメーション設定
        theAnim003 = NSAnimation(duration: 10.0, animationCurve: NSAnimationCurve.EaseInOut)
        
        theAnim003!.frameRate = 20.0
        theAnim003!.delegate = self
        theAnim003!.animationBlockingMode = NSAnimationBlockingMode.Blocking
        
        //登録
        for (i = 0 ; i<count ; i++){
            theAnim003!.addProgressMark(progMarks[i])
            NSLog("bbb %f",progMarks[i])
        }
        dispatch_async(dispatch_get_main_queue()) {
            self.theAnim003!.startAnimation()
        }
        
    }

Swift1.1

 //NSAnimation runLoopModesForAnimating
    @IBAction func function003(sender: AnyObject) {
        //NSAnimationProgress
        var progMarks : [NSAnimationProgress] =  [
            0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5,
            0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0  ]
        var i :Int
        var count :Int = 20
        //アニメーション設定
        theAnim003 = NSAnimation(duration: 10.0, animationCurve: NSAnimationCurve.EaseInOut)
        
        theAnim003.frameRate = 20.0
        theAnim003.delegate = self
        theAnim003.animationBlockingMode = NSAnimationBlockingMode.Blocking
        
        //登録
        for (i = 0 ; i<count ; i++){
            theAnim003.addProgressMark(progMarks[i])
            NSLog("bbb %f",progMarks[i])
        }
        dispatch_async(dispatch_get_main_queue()) {
            self.theAnim003.startAnimation()
        }
        
    }


//アニメーション
    func animation(animation: NSAnimation, didReachProgressMark progress: NSAnimationProgress) {
        
        if (animation == theAnim001?){
            NSLog("theAnim001")
        }
        if (animation == theAnim002?){
            NSLog("theAnim002")
        }
        if (animation == theAnim003?){
            NSLog("theAnim003")
            var returnValue = theAnim003.runLoopModesForAnimating?
            if ((returnValue) != nil){
                for mode : AnyObject in returnValue! {
                    NSLog("!! %@",mode as NSString)
                }
            }
        }
    }