猎豆优选

TBSDKProgressDelegate.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // TBSDKProgressDelegate.h
  3. // TBSDK
  4. //
  5. // Created by 亿刀 on 14-3-6.
  6. // Copyright (c) 2014年 Taobao.com. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @class TBSDKConnection;
  10. @protocol TBSDKProgressDelegate <NSObject>
  11. @optional
  12. // These methods are used to update UIProgressViews (iPhone OS) or NSProgressIndicators (Mac OS X)
  13. // If you are using a custom progress delegate, you may find it easier to implement didReceiveBytes / didSendBytes instead
  14. #if TARGET_OS_IPHONE
  15. - (void)setProgress:(float)newProgress;
  16. #else
  17. - (void)setDoubleValue:(double)newProgress;
  18. - (void)setMaxValue:(double)newMax;
  19. #endif
  20. // Called when the request receives some data - bytes is the length of that data
  21. - (void)request:(TBSDKConnection *)connection didReceiveBytes:(long long)bytes;
  22. // Called when the request sends some data
  23. // The first 32KB (128KB on older platforms) of data sent is not included in this amount because of limitations with the CFNetwork API
  24. // bytes may be less than zero if a request needs to remove upload progress (probably because the request needs to run again)
  25. - (void)request:(TBSDKConnection *)connection didSendBytes:(long long)bytes;
  26. // Called when a request needs to change the length of the content to download
  27. - (void)request:(TBSDKConnection *)connection incrementDownloadSizeBy:(long long)newLength;
  28. // Called when a request needs to change the length of the content to upload
  29. // newLength may be less than zero when a request needs to remove the size of the internal buffer from progress tracking
  30. - (void)request:(TBSDKConnection *)connection incrementUploadSizeBy:(long long)newLength;
  31. @end