本文介绍了在特定时间段后如何使用performselector将带有参数的函数包含在内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这个iPhone应用程序编程的新手.我有一个带有一个参数类型的函数作为结构指针.如下所示

I am new to this iPhone app programming.I have a function with one argument type as structure pointer. This is shown below

(void)responce:(structurePtr *)someData
{
......
......
}

我想在5秒的时间间隔后使用performselector method调用此函数.请告诉我如何使用performselector

I want to call this function using performselector method after 5 seconds of time interval. Please tell me how to call above responce function using performselector

提前谢谢.

推荐答案

使用:- (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay

[yourObject performSelector:@selector(responce:) withObject:someData afterDelay:5];

注意:不能保证您的选择器会在5秒后准确执行-它只是指定将消息发送到对象之前的最短时间.

Note: it is not guaranteed that your selector will be performed exactly after 5 seconds - it just specifies the minimum time before the message is sent to your object.

这篇关于在特定时间段后如何使用performselector将带有参数的函数包含在内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 01:15