国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

獲取要下載文件的大小信息

2019-11-14 20:31:13
字體:
來源:轉載
供稿:網友

原文來自IOS教程網,轉載時請注明文章的來源:http://ios.662p.com/thread-1660-1-1.html

 

NSURLConnectionDataDelegate方法中有:

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{    //This method is called when the server has determined that it     //has enough information to create the NSURLResponse.        //It can be called multiple times, for example in the case of a     //redirect, so each time we reset the data.        //receivedData is an instance variable declared elsewhere.        NSLog(@"要下載文件大小為 %lld",response.expectedContentLength);    [self.receivedData setLength:0];}

  

  1. //在此方法中可以更新進度條 
  2. -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
  3. {
  4.     //PRovide an indication of the connection's progress to the user.
  5.     //progressView.progress = [self.receivedData length] / totalSize
  6.     [self.receivedData appendData:data];
  7. }

復制代碼

 大家如果有什么ios開發的問題,可以到ios教程網了解一下。

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黄梅县| 含山县| 东方市| 漳平市| 屏南县| 五常市| 家居| 奈曼旗| 页游| 屏东市| 禄劝| 湄潭县| 安顺市| 黔西| 波密县| 襄樊市| 大理市| 宁远县| 山西省| 蕉岭县| 浦城县| 松江区| 平阳县| 沈丘县| 宁河县| 理塘县| 河间市| 白城市| 兴宁市| 瑞昌市| 武功县| 海盐县| 上栗县| 佛冈县| 榆林市| 民县| 余江县| 定襄县| 柳州市| 岐山县| 当阳市|