Passing Data through NSTimer UserInfo

后端 未结 6 1995
抹茶落季
抹茶落季 2021-01-31 09:18

I am trying to pass data through userInfo for an NSTimer call. What is the best way to do this? I am trying to use an NSDictionary, this is simple enough when I have Objective-C

6条回答
  •  忘了有多久
    2021-01-31 10:00

    Your call is right, but you don't have to cast the dictionary to id. You can get the userInfo back with the following line in your notifyPause1: method:

    - (void)notifyPause1:(NSTimer *)timer {
    
        NSDictionary *dict = [timer userInfo];
    
    }
    

提交回复
热议问题