I am using SVProgressHUD
as an activity indicator in my project. I don't want to show HUD
if my data loads faster than 3 seconds, it should show only after this time period. I am not able to delay the loading of SVProgress
HUD
.
Asked
Active
Viewed 302 times
1

Bowdzone
- 3,827
- 11
- 39
- 52

jayant rawat
- 318
- 2
- 12
1 Answers
2
Use following code :
[self performSelector:@selector(addHUD) withObject:nil afterDelay:3.0f];
If data loads before 3 sec call
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(addHUD) object:nil];
Also add above line in dealloc method.

user4261201
- 2,324
- 19
- 26

Aruna Mudnoor
- 4,795
- 14
- 16
-
how to write condition for data loads before 3.0 seconds? – jayant rawat Jan 05 '16 at 07:11
-
Take time timestamp before starting the data load. Start data loading, inside data loading completion handler compare current time stamp with previous time stamp. – Aruna Mudnoor Jan 07 '16 at 07:27
-
Same thing will work. Only change will be you have to maintain add member which holds the time stamp before you start data load. Compare time in data load finish delegate method. – Aruna Mudnoor Aug 01 '16 at 09:23
-
if would be helpful if u could provide some code @arun ammannaya – jayant rawat Aug 02 '16 at 05:52