@selector() in Swift?

后端 未结 23 2539
清酒与你
清酒与你 2020-11-21 15:24

I\'m trying to create an NSTimer in Swift but I\'m having some trouble.

NSTimer(timeInterval: 1, target: self, selector: test(), us         


        
23条回答
  •  甜味超标
    2020-11-21 16:10

    Change as a simple string naming in the method calling for selector syntax

    var timer1 : NSTimer? = nil
    timer1= NSTimer(timeInterval: 0.1, target: self, selector: Selector("test"), userInfo: nil, repeats: true)
    

    After that, type func test().

提交回复
热议问题