I’m new to iOS and developing an app interact with map.
Here’s situation:
I have to send a request for some point data when regionDidChangeAnimated: delegate called.
I’m using AFNetworking for this.
but when if excessive scrolling the map cause heavy request to server.
During excessive map scrolling, every ‘Touch Up’ end up ‘regionDidChangeAnimated’,
So if it is possible, I’d like to make this request in lazy way.
What I think for this is:
In regionDidChangeAnimated, hold sending a request in certain time (0.2sec or half sec),
if there’s no more regionDidChangeAnimated happens, then fire the request to server.
Any suggestion please.
You can do this using an
NSTimer. When you get aregionDidChangeAnimatedcall, set the timer for 0.2 seconds. If the timer expires the OS will call whatever you told the timer to call, and then you can make your request to the server if no otherregionDidChangeAnimatedcalls have occurred.