简体   繁体   English

iOS定时图像重新加载

[英]iOS timed image reload

I have a web cam I'm pulling images from for an iPhone app. 我有一个网络摄像头,我正在从iPhone应用程序中提取图像。 I put the code that pulls the image into the view in viewWillAppear. 我在viewWillAppear中放置了将图像拉入视图的代码。 That works pretty well but what I really want is to reload the image every 30 seconds. 效果很好,但我真正想要的是每30秒重新加载一次图像。 Is there a setInterval equivalent that I can use to execute this? 我可以使用setInterval等效项来执行此操作吗?

I believe you could use: 我相信您可以使用:

 [NSTimer scheduledTimerWithTimeInterval:30.0 target:self selector:@selector(reloadImage:) userInfo:nil repeats:YES];

And then have your reload method like this: 然后让您的重载方法如下:

-(void)reloadImage:{
    //Your reload code
}

:) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM