Tuesday, October 25, 2011

NFC Primer for Developers

NFC Primer for Developers

A good turtoial for object saving on plist

http://cocoadevcentral.com/articles/000084.php

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)

Postby ryanagler » Tue Aug 02, 2011 10:12 pm
I dont know the reprecussions of this, but it appears I got it to work by replacing the Reachability.h that comes with ASIHTTPRequest with Apple's version 2.2 here:

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.