2011-02-15 92 views
1

嗨我做了一個應用程序下載大量的數據,我想添加一些動畫,爲什麼它加載和凍結屏幕。 我已經找到函數的工作,但它只是凍結按鈕 功能:Objective-C:如何凍結屏幕並添加加載動畫?

[super setEditing:(BOOL)editing animated:(BOOL)animated]; 
    self.navigationItem.rightBarButtonItem.enabled = !editing; 

我見過一些應用程序,它已經在使用這種動畫。圖像看起來應該是這樣:enter image description here 感謝

回答

2

您可以使用NSURLDownload進行異步下載,您可以使用委託方法來確定進度。

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLDownload_Class/Reference/Reference.html

然後使用NSProgressIndicator可以顯示進度以同樣的方式你的那個形象一樣。

+0

但我使用 \t theRequest = [[[NSMutableURLRequest的alloc] INIT]自動釋放]; \t [theRequest setURL:[NSURL URLWithString:@「URL」]]; \t [theRequest setHTTPMethod:@「POST」]; \t [theRequest setValue:postLength forHTTPHeaderField:@「Content-Length」]; \t [theRequest setValue:@「application/x-www-form-urlencoded」forHTTPHeaderField:@「Content-Type」]; \t [theRequest setHTTPBody:postData]; \t \t [theRequest setHTTPShouldHandleCookies:YES]; \t \t theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; \t \t xmlFile = [[NSMutableData data] retain]; – Csabi 2011-02-15 14:43:46