在backgound中经过3秒的时间间隔后重复调用方法

Viz*_*llx 3 iphone xcode objective-c nsthread ios

我经历了很多网站,但仍然没有答案.

我有一个方法,假设void xyz(),它会自动被调用视图控制器每隔3秒.

我不知道该使用什么,我是否必须使用NSThreadPerformSelector.

指导我们.

mor*_*oko 9

从ViewDidLoad方法调用此方法.当您的视图将出现在iPhone设备或模拟器中时,ViewDidLoad将会出现.

[NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(runMethod) userInfo:nil repeats:YES];


    -(void)runMethod

    {

    }
Run Code Online (Sandbox Code Playgroud)