Re: progress bar when creating file
Re: progress bar when creating file
- Subject: Re: progress bar when creating file
- From: Adam Leonard <email@hidden>
- Date: Tue, 8 Nov 2005 21:46:51 -0800
how could I determine the total bytes of the file to
be appended using NSURLConnection? coz I assume I need that total
bytes in order to update the progress indicator whenever the
didReceiveData function is called?
With NSURLConnection, you can get the data received so far with
connection:didRevieveData, then do [data length] to get the bytes
downloaded so far.
To get the total number of bytes in the URL, you can use an
NSURLRequest, put in the URL, then call [yourRequest
valueForHTTPHeaderField:@"Content-Length"]
That should give you an NSString, and from there, you can turn it
into an int and compare it to the data you have received so far
I haven't tried this, but I think it will work.
On a totally unrelated matter, I would also like to programmatically
set this application running on the background the moment the user log
into the OS. I've so far been able to program it to appear on the
dock. But apparently the application would only run the moment the
user click and bring it up.
Is there anyway I could set such thing?
To get it to run in the background set NSUIElement and NSBGonly to 1
in your info.plist
To get it to start at login, search the archives. This has been
brought up many times
Adam Leonard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden