how to use the progress bar in the iphone app

后端 未结 5 1912
情歌与酒
情歌与酒 2020-12-07 21:31

In my iPhone app I am downloading some data from an FTP server. To show the action I am using UIActivityIndicator. If I put UIProgressView there in

5条回答
  •  自闭症患者
    2020-12-07 21:59

    You can display progress of progress bar with these line of code

    -(void) connection:(NSURLConnection *) connection 
    didReceiveData:(NSData *) data {
       if (file)
       { 
           [file seekToEndOfFile];
            progressView.progress = ((float)recievedData / (float) xpectedTotalSize);
       } 
         [file writeData:data];
         recievedData += data.length;
         NSLog(@"Receiving Bytes: %d", recievedData);
    }
    

提交回复
热议问题