Menu

UIImageView loading from a URL without the cache

Alex F
2014-03-20
2014-03-24
  • Alex F

    Alex F - 2014-03-20

    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;

     
  • Babak Yaghoobi

    Babak Yaghoobi - 2014-03-23

    Hi Alex

    Added.

    Thank you for feedback.

    Regards

     
  • Alex F

    Alex F - 2014-03-24

    Babok,

    Awesome.

    Thank you.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.