I am using tableview and I want to call a method after some time duration.This method return a array and reload the tableview.I want within this time duration UI doesn't stuck.
Asked
Active
Viewed 76 times
-3
-
1`–performSelector:withObject:afterDelay:`, perhaps? – holex Sep 04 '14 at 13:55
-
1`dispatch_after`? `NSTimer`? – rmaddy Sep 04 '14 at 14:01
-
possible duplicate of [How can I delay a method call for 1 second?](http://stackoverflow.com/questions/920675/how-can-i-delay-a-method-call-for-1-second) – Guillaume Algis Sep 04 '14 at 14:04
1 Answers
0
Best to use Grand Central Dispatch (GCD). If you call dispatch_after()
, you can run a block of code whenever you want.
// Run this code after 1 second.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self someMethod];
});

colinbrash
- 481
- 2
- 11