0

Lets say I have a ViewController1 and a ViewController2. I segued from VC1 to VC2. So I am in ViewController 2 and I want to use

[NSTimer scheduledTimerWithTimeInterval:10 target: selector: userInfo:nil repeats:NO] 

to execute a method on ViewController1 (let's call it method1.) What are the parameters for NSTimer? Thanks

James
  • 291
  • 1
  • 3
  • 13

2 Answers2

1

Why are you trying to do this? I'd use a delegate (protocol) and let VC1 handle the timing in case VC2 is destroyed.

On segue:

VC2.delegate = VC1

On event:

self.delegate.firedEvent()

On VC1:

func firedEvent() {
    // delay here
}
cjnevin
  • 311
  • 2
  • 8
0

target: ViewController1 selector: @selector(method1:)

see also: How do I use NSTimer?

Community
  • 1
  • 1
ronhippler
  • 106
  • 1
  • 6