我想用ASIFormDataRequest显示uiprogress栏。我google了它,但我找不到关于uiprogressView与ASIFormDataRequest,我只是找到uiprogressView与NSURLConnection。请告诉我是否有可能。
//这是我上传数据的方法。
-(NSMutableArray*)getUploadVideo:(NSString*)titleName userID:(NSString*)userId token:(NSString*)tokenID description:(NSString*)desc videoID:(NSString*)video_id privateOrPublic:(NSString*)privacyID pathOfVideoFile:(NSString*)path mode:(NSString*)potLand;
{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://%@/aircastdev/RestServices/fileUpload"],kId];
[request setDelegate:self];
[request setDidFailSelector:@selector(uploadFailed:)];
[request setDidFinishSelector:@selector(uploadFinished:)];
[request setDidFinishSelector:@selector(requestFailed:)];
[request setDidFinishSelector:@selector(requestFinished:)];
[request setPostValue:titleName forKey:@"title"];
[request setPostValue:userId forKey:@"user_id"];
[request setPostValue:tokenID forKey:@"token"];
[request setPostValue:desc forKey:@"desc"];
[request setPostValue:video_id forKey:@"video_id"];
[request setPostValue:privacyID forKey:@"is_private"];
[request setPostValue:potLand forKey:@"mode"];
NSString *url = [[NSURL fileURLWithPath:path] path];
[request setFile:url withFileName:[NSString stringWithFormat:@"%@.mov",titleName] andContentType:@"video/MOV" forKey:@"file"];
[request setTimeOutSeconds:50000];
[request setRequestMethod:@"POST"];
// EDITED LINE
[request setUploadProgressDelegate:myProgressView];
[request startSynchronous];
SBJSON *sbJason = [[SBJSON alloc] init];
getUploadArray = [sbJason objectWithString:self.response];
return getUploadArray;
}
//上传完成此方法调用。
- (void)requestFinished:(ASIHTTPRequest *)request
{
// alert: request is successfully sent
self.response = [request responseString]; //stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}
答案 0 :(得分:1)
使用它:
[request setDownloadProgressDelegate:progressView];
或
[request setUploadProgressDelegate:myProgressIndicator];
其中progressView
是UIProgressView
also have a look here