So I needed to load an image (UIImageView) from a URL asynchronously, and not use the cache. My problem is that the HTTP component is still pulling from the HTTP cache, so I added the following line in the LoadImageAsyncURL procedure:
if not FCacheImage then DPFHttp.URLRequestCache := rcReloadIgnoringLocalCacheData;
I don't know if this is the best way to do it... please let me know if there's a better way.
Thanks again for the great components.
Alex
About line 460 of DPF.iOS.UIImageView
// ------------------------------------------------------------------------------ procedure TDPFImageView.LoadImageAsyncURL( URL: string ); begin ShowIndicatorView; if Assigned( OnBeforeAsyncImageLoaded ) then OnBeforeAsyncImageLoaded( Self );
if not Assigned( DPFHttp ) then begin DPFHttp := TDPFHttp.Create( nil ); DPFHttp.OnReceiveDataBin := OnFinishAsyncLoading; DPFHttp.OnError := OnErrorAsyncLoading; DPFHttp.OperationQueue := FOperationQueue; DPFHttp.OnReceiveProgress := FOnProgress; if not FCacheImage then DPFHttp.URLRequestCache := rcReloadIgnoringLocalCacheData; // --ADDED-- end; // DPFHttp.SetImageAsync( URL, FUIImageView ); DPFHttp.GetUrlContentData( URL, [], [], [], True ); end;
Hi Alex
Added.
Thank you for feedback.
Regards
Babok,
Awesome.
Thank you.
Log in to post a comment.
So I needed to load an image (UIImageView) from a URL asynchronously, and not use the cache. My problem is that the HTTP component is still pulling from the HTTP cache, so I added the following line in the LoadImageAsyncURL procedure:
I don't know if this is the best way to do it... please let me know if there's a better way.
Thanks again for the great components.
Alex
About line 460 of DPF.iOS.UIImageView
// ------------------------------------------------------------------------------
procedure TDPFImageView.LoadImageAsyncURL( URL: string );
begin
ShowIndicatorView;
if Assigned( OnBeforeAsyncImageLoaded ) then
OnBeforeAsyncImageLoaded( Self );
if not Assigned( DPFHttp ) then
begin
DPFHttp := TDPFHttp.Create( nil );
DPFHttp.OnReceiveDataBin := OnFinishAsyncLoading;
DPFHttp.OnError := OnErrorAsyncLoading;
DPFHttp.OperationQueue := FOperationQueue;
DPFHttp.OnReceiveProgress := FOnProgress;
if not FCacheImage then DPFHttp.URLRequestCache := rcReloadIgnoringLocalCacheData; // --ADDED--
end;
// DPFHttp.SetImageAsync( URL, FUIImageView );
DPFHttp.GetUrlContentData( URL, [], [], [], True );
end;
Hi Alex
Added.
Thank you for feedback.
Regards
Babok,
Awesome.
Thank you.