2009-10-31 7 views
3

내 앱이 내 서버에 이미지를 업로드합니다. 진행률 표시 줄로이 이벤트를 표시하고 싶습니다.이미지를 내 서버에 업로드 할 때 진행률 표시 줄 표시

- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite 

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 

- (void)connectionDidFinishLoading:(NSURLConnection *)connection 

나는이 위의 방법을 사용하여 콘솔에서 진행되는 것을 볼 수 있습니다. 하지만 '진행률 표시 줄'을 사용하여 nib 파일에서 어떻게 처리합니까?

+0

하지만, 당신이 이제까지 할 수 있었다 :이 같은 방법 didSendBodyData : totalBytesWritten : totalBytesExpectedToWrite를 이? 어떤 최신 아이디어를 어떻게 최신 Facebook SDK 3.1에서 사용할 수 있습니까? 감사! – Jan

답변

15

당신이 UIProgressView를 사용하는 경우는 연결에서 진행 설정할 수 있습니다 :이 아주 오래된 후 질문을 알고

float progress = [[NSNumber numberWithInteger:totalBytesWritten] floatValue]; 
float total = [[NSNumber numberWithInteger: totalBytesExpectedToWrite] floatValue]; 
progressView.progress = progress/total; 
+4

값을 그냥 쓸 수있는 경우 NSNumber를 인스턴스화해야하는 이유는 무엇입니까? – brian

+2

progressView.progress = (float) totalBytesWritten/totalBytesExpectedToWrite –

관련 문제