Tuesday, October 25, 2011
Add UIProgressView to UITableViewCell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"downloadcell"];
if(cell==nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:@"downloadcell"] autorelease];
UIProgressView* downPreView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
downPreView.tag = 1234;
downPreView.frame = CGRectMake(400,70, 200,10);
[cell.contentView addSubview:downPreView];
}
//update the progress
UIProgressView* downPreView = (UIProgressView*)[cell viewWithTag:123]; downPreView.progress = downloadPre;
Monday, October 17, 2011
PhoneGap and ASIHTTPRequest conflicting problem
Re: Conflict with ASIHTTPRequest (Reachability Issue)
http://developer.apple.com/library/ios/ ... lementID_5
get iPhone udid by phoneGap api
|
var string = device.uuid;
PhoneGap api docs are here if you need any more info... http://docs.phonegap.com/phonegap_device_device.md.html#device.uuid |
How to get the Blackberry address book image photo
Vector contactList = Phone.getContactsByPhoneNumber(inputNumber); Contact contact = (Contact) contactList.elementAt(0); byteStream = contact.getBinary(Contact.PHOTO, Contact.ATTR_NONE); EncodedImage contactPic = EncodedImage.createEncodedImage(byteStream, 0, byteStream.length); String picType = String.valueOf( contactPic.getImageType() );
Wednesday, June 1, 2011
iphone webview loading percentage
Instead of using a UIWebView, you can pull the webpage down as an NSData object using an NSURLConnection. When you get the initial response from your request from
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
the webserver should return a value of "expected content size" (which should be included in the response). Then you will keep getting the following method called each time you receive data:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
Keep appending the data to an existing NSData object. Then you can check the size of your current data object (NSData.bytes) against the expected response size.
percentage = (myData.bytes/theResponse.expectedContentSize)*100;
Then you can update a progress bar with that percentage! When
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
runs, use your data to call
[myWebView loadData:myData MIMEType:myMimeType textEncodingName:myEncoding baseURL:baseURL];
and it will load everything you pulled down into your web view.
Subscribe to:
Posts (Atom)