NSXML Parsing with Rest api and Mapview with Annotation?


Hi,

Today I am going to explain you How to perform Parsing with NSXML and How to show annotation in MKMapView.

Here I am Taking 1 UITextField and 1 UIButton.Whatever city name you will enter in the Textfield and Press Button it will show you in MKMapView with Annotation.

Step 1: Add Frameworks

1.CoreLocation

2.MapKit

step 2: Add Files

1.Place.h and Place.m

2.PlaceMark.h and PlaceMark.m (I will Provide).

step 3: Import Files in your view controller’s header file  and Declare Variables as shown in the Screenshots.

step 4: @synthesize all Variables as shown.

Step 5: Take NSString with Rest api and provide the textfield value to it.Make the connection with URL Request as shown.

NSString *strUrl = [NSString stringWithFormat:@”http://maps.googleapis.com/maps/api/geocode/xml?address=%@&sensor=false”,self.txtSearch.text];
NSURLConnection *conn = [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:strUrl]] delegate:self];

check the connection object

if(conn)
self.data = [[NSMutableData data] init];

Step 6:Implement all the connection Methods as shown.

#pragma mark – Connection Delegates Methods

– (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
NSLog(@”Error ==>%@”,error);

}
– (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{

}

– (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
[self.data appendData:data];

}
– (void)connectionDidFinishLoading:(NSURLConnection *)connection{
//Standard NSXMLParser – SAX Parser
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:self.data];
parser.delegate=self;
[parser parse];
}
Step 7:Now Implement Parsing Methods with Root Tag and Object Tag so it will give’s you all the tags.

#pragma mark – NSXML Parsing Delegates Methods

// Document handling methods
// sent when the parser begins parsing of the document.
– (void)parserDidStartDocument:(NSXMLParser *)parser{

}
// sent when the parser finds an element start tag.
– (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
if([elementName isEqualToString:@”GeocodeResponse“])
self.arrResult = [NSMutableArray array];
else if ([elementName isEqualToString:@”result“])
self.dMain = [NSMutableDictionary dictionary];
}
– (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
self.strings=string;
}

// sent when an end tag is encountered. The various parameters are supplied as above.
// sent when the parser has completed parsing. If this is encountered, the parse was successful.
– (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
if([elementName isEqualToString:@”GeocodeResponse“]){

}else if ([elementName isEqualToString:@”result“])
{
[self.arrResult addObject:self.dMain];
self.dMain=nil;
}else {
[self.dMain setObject:self.strings forKey:elementName];
}
}

Step 7:In parserDidEndDocument method you will get all the value whatever you required.Here I am getting Latitude/Longitude and Address as shown.

=> Make the object of Place class and Provide the parameter also make the object of PlaceMark and Provide the object of place class and Add the Placemark object to MapView as an Annotation.

– (void)parserDidEndDocument:(NSXMLParser *)parser{
NSLog(@”Array = %@”,self.arrResult);

float latitude= [[[self.arrResult objectAtIndex:0] valueForKey:@”lat”] floatValue];
float longitude=[[[self.arrResult objectAtIndex:0] valueForKey:@”lng”] floatValue];

Place* home = [[Place alloc] init];
home.name = [[self.arrResult objectAtIndex:0] valueForKey:@”formatted_address”];
home.latitude = latitude;
home.longitude = longitude;

PlaceMark *from = [[PlaceMark alloc] initWithPlace:home];
[self.mView addAnnotation:from];
[self centerMap];
}

Step 8:For Annotation here you have to Integrate MKMapView’s Annotation Delegate methods as shown.

#pragma mark – MapView Annotation

– (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
// if it’s the user location, just return nil.
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;

// try to dequeue an existing pin view first
static NSString* AnnotationIdentifier = @”AnnotationIdentifier”;
MKPinAnnotationView* pinView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
pinView.animatesDrop=YES;
pinView.canShowCallout=YES;
pinView.pinColor=MKPinAnnotationColorPurple;
return pinView;
}

You can download the sample code From Here.

 

 

 

How to Launching Other Apps within an iPhone Application?


Here I am going to explain you few key feature using NSURL and UIApplication.

Examples of some of the key applications that you can launch via URL are:

Launch Google Maps


Launch Apple Mail


Dial a Phone Number


Launch the SMS Application


Launch the Browser


Launch the AppStore

Launching the Browser from within an iPhone application

 

 

Launch Google Maps

The URL string for launching Google Maps with a particular keyword follows this structure:
http://maps.google.com/maps?q=${QUERY_STRING}
The only trick to this is to ensure that the value for the ${QUERY_STRING} is properly URL encoded. Here is a quick example of how you would launch Google Maps for a specific address:
// Create your query …
NSString* searchQuery = @”1 Infinite Loop, Cupertino, CA 95014″;

// Be careful to always URL encode things like spaces and other symbols that aren’t URL friendly

searchQuery =  [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];

// Now create the URL string …

NSString* urlString = [NSString stringWithFormat:@”http://maps.google.com/maps?q=%@&#8221;, searchQuery];

// An the final magic … openURL!
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

Launch Apple Mail
Also very useful, is the ability to enable a user to quickly send an email by launching the email client in compose mode and the address already filled out. The format of this URI should be familiar to anyone that has done any work with HTML and looks like this:

mailto://${EMAIL_ADDRESS}

For example, here we are opening the email application and filling the “to:” address with info@iosdevelopertips.com :
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”mailto://info@iosdevelopertips.com”]];

Dial a Phone Number (iPhone Only)


You can use openURL: to dial a phone number. One advantage this has over other URLs that launch applications, is that the dialer will return control back to the application when the user hits the “End Call” button.
Anyone familiar with J2ME or WML will find this URL scheme familiar:

tel://${PHONE_NUMBER}

Here is an example of how we would dial the number (900) 867-9999:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”tel://9008679999″]];
NOTE When providing an international number you will need to include the country code.

Launch the SMS Application

Also not supported by the iPod Touch, is the ability to quickly setup the SMS client so that your users can quickly send a text message. It is also possible to provide the body of the text message.
The format looks like this:

sms:${PHONENUMBER_OR_SHORTCODE}

NOTE: Unlike other URLs, an SMS url doesn’t use the “//” syntax. If you add these it will assume it is part of the phone number which is not.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”sms:55555″]];

NOTE: According to the official SMS specification, you should be able to send a body as well as the phone number by including “?body=” parameter on the end of the URL … unfortunately Apple doesn’t seem to support this standard.

Launching the AppStore

Finally, it is worth noting that you can launch the AppStore and have the “buy” page of a specific application appear. To do this, there is no special URL scheme. All you need to do is open up iTunes to the application you want to launch; right-click on the application icon at the top left of the page; and select Copy iTunes Store URL .
The URL will look something like this:

http://itunes.apple.com/in/app/angry-birds-space-hd-free/id526337775?mt=8

Launching the AppStore URL is exactly the same as you would launch the browser. Using the link above, here is an example of how we would launch the AppStore:

NSURL *appStoreUrl = [NSURL URLWithString:@”http://itunes.apple.com/in/app/angry-birds-space-hd-free/id526337775?mt=8″%5D;
%5B%5BUIApplication sharedApplication] openURL:appStoreUrl];

 

Launching the Browser from within an iPhone application

It is sometimes nice to be able to launch a browser from within your applications. Though not as elegant as the use of a UIWebView, it is much easier.
NOTE Because it is possible for an application to bind itself to a URL (like Google Maps), this technique can also be used to launch other applications on the device.
Here is a simple example of how to open safari with a specific URL:

NSURL *url = [NSURL URLWithString:@”https://iosrider.wordpress.com”%5D;
[[UIApplication sharedApplication] openURL:url];

iPad/iPhone forward geocoding API using Google geocoding service


This sample iPad application contains a search bar and a large UIMapView. Search results are visualized on the map with a placemark and by clicking the placemark the map will zoom to the viewport returned from the geocoding service. When I started working with the geocoding service it was still in version two, this last week Google launched version three. Version two will be depricated of course but I had already written the parser for version two so I’ve included it as well in my sample. Of course the API works for iPhone as well. Because the API contains quite a lot of code you will find the code inside the sample project at the bottom of this page.

- (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar {

	NSLog(@"Searching for: %@", searchBar.text);
	if(forwardGeocoder == nil)
	{
		forwardGeocoder = [[BSForwardGeocoder alloc] initWithDelegate:self];
	}

	// Forward geocode!
	[forwardGeocoder findLocation:searchBar.text];

}
-(void)forwardGeocoderFoundLocation
{
	if(forwardGeocoder.status == G_GEO_SUCCESS)
	{
		int searchResults = [forwardGeocoder.results count];

		// Add placemarks for each result
		for(int i = 0; i < searchResults; i++)
		{
			BSKmlResult *place = [forwardGeocoder.results objectAtIndex:i];

			// Add a placemark on the map
			CustomPlacemark *placemark = [[CustomPlacemark alloc] initWithRegion:place.coordinateRegion];
			placemark.title = place.address;
			[mapView addAnnotation:placemark];

			NSArray *countryName = [place findAddressComponent:@"country"];
			if([countryName count] > 0)
			{
				NSLog(@"Country: %@", ((BSAddressComponent*)[countryName objectAtIndex:0]).longName );
			}

			[countryName release];
		}

		if([forwardGeocoder.results count] == 1)
		{
			BSKmlResult *place = [forwardGeocoder.results objectAtIndex:0];

			// Zoom into the location
			[mapView setRegion:place.coordinateRegion animated:TRUE];
		}

		// Dismiss the keyboard
		[searchBar resignFirstResponder];
	}
}
 When search has executed the geocoder contains the result and a status code. The status code is from Google and to support both version 2 and 3 of the API there’s an enum containing response codes. If everything goes well the status should be “G_GEO_SUCCESS” and the “results” property will contain an array of BSKmlResult objects which contain the location information returned for the query. Here’s an example query for my home town Stockholm (Google geocoding service version 3) :http://maps.google.com/maps/api/geocode/xml?address=stockholm&sensor=false.
The details for the service can be found here:http://code.google.com/apis/maps/documentation/geocoding/.
There are multiple arguments you can pass to the search url, you should read the geocoding documentation and check the search url in the application before you implement this in your own app.

BSForwardGeocoder

#import <Foundation/Foundation.h>
#import "BSGoogleV2KmlParser.h"
#import "BSGoogleV3KmlParser.h"

// Enum for geocoding status responses
enum {
	G_GEO_SUCCESS = 200,
	G_GEO_BAD_REQUEST = 400,
	G_GEO_SERVER_ERROR = 500,
	G_GEO_MISSING_QUERY = 601,
	G_GEO_UNKNOWN_ADDRESS = 602,
	G_GEO_UNAVAILABLE_ADDRESS = 603,
	G_GEO_UNKNOWN_DIRECTIONS = 604,
	G_GEO_BAD_KEY = 610,
	G_GEO_TOO_MANY_QUERIES = 620
};

@protocol BSForwardGeocoderDelegate <NSObject>
@required
-(void)forwardGeocoderFoundLocation;
@optional
-(void)forwardGeocoderError:(NSString *)errorMessage;
@end

@interface BSForwardGeocoder : NSObject {
	NSString *searchQuery;
	NSString *googleAPiKey;
	int status;
	NSArray *results;
	id<BSForwardGeocoderDelegate> delegate;
}
-(id) initWithDelegate:(id<BSForwardGeocoderDelegate>)del;
-(void) findLocation:(NSString *)searchString;

@property (assign) id<BSForwardGeocoderDelegate> delegate;
@property (nonatomic, retain) NSString *searchQuery;
@property (nonatomic, readonly) int status;
@property (nonatomic, retain) NSArray *results;

@end

BSKmlResult
The result class is the same for both version 2 and 3 of the service. A big difference in the returned information between the versions is the way address components are returned, in version three more information is returned and therefore I’ve created another class to store the address component information. The properties: countryNameCode, countryName, subAdministrativeAreaName and localityName are for version two only. For version three all address information is stored in the “addressComponents” array (contains BSAddressComponent objects). Because there is really no reason to use version 2 anymore you probably want to remove this code for your own application.

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import "BSAddressComponent.h"

@interface BSKmlResult : NSObject {
	NSString *address;
	NSString *countryNameCode;
	NSString *countryName;
	NSString *subAdministrativeAreaName;
	NSString *localityName;
	float viewportSouthWestLat;
	float viewportSouthWestLon;
	float viewportNorthEastLat;
	float viewportNorthEastLon;
	float boundsSouthWestLat;
	float boundsSouthWestLon;
	float boundsNorthEastLat;
	float boundsNorthEastLon;
	float latitude;
	float longitude;
	float height;
	NSInteger accuracy;
	NSArray *addressComponents;
}

@property (nonatomic, retain) NSString *address;
@property (nonatomic, assign) NSInteger accuracy;
@property (nonatomic, retain) NSString *countryNameCode;
@property (nonatomic, retain) NSString *countryName;
@property (nonatomic, retain) NSString *subAdministrativeAreaName;
@property (nonatomic, retain) NSString *localityName;
@property (nonatomic, retain) NSArray *addressComponents;
@property (nonatomic, assign) float latitude;
@property (nonatomic, assign) float longitude;
@property (nonatomic, assign) float viewportSouthWestLat;
@property (nonatomic, assign) float viewportSouthWestLon;
@property (nonatomic, assign) float viewportNorthEastLat;
@property (nonatomic, assign) float viewportNorthEastLon;
@property (nonatomic, assign) float boundsSouthWestLat;
@property (nonatomic, assign) float boundsSouthWestLon;
@property (nonatomic, assign) float boundsNorthEastLat;
@property (nonatomic, assign) float boundsNorthEastLon;
@property (readonly) CLLocationCoordinate2D coordinate;
@property (readonly) MKCoordinateSpan coordinateSpan;
@property (readonly) MKCoordinateRegion coordinateRegion;

-(NSArray*)findAddressComponent:(NSString*)typeName;

@end

To make it somewhat simple to find address components I’ve added a method that will search for components for you. Using version 3 of the geocoding service you will get the country name using this code:

NSArray *countryName = [BSKmlResultPlace findAddressComponent:@"country"];
if([countryName count] > 0)
{
	NSLog(@"Country: %@", ((BSAddressComponent*)[countryName objectAtIndex:0]).longName );
}
[countryName release];

There are also properties to make the result simple to use with a MKMapView. The “coordinate” property returns a CLLocationCoordinate2D object, “coordinateSpan” calculates and returns a MKCoordinateSpan object for setting the map viewport. The “coordinateRegion” combines both coordinate and coordinateSpan returning a MKCoordinateRegion object that can be used to directly move your MKMapView to the right place.

BSAddressComponent

#import <Foundation/Foundation.h>

@interface BSAddressComponent : NSObject {
	NSString *longName;
	NSString *shortName;
	NSArray *types;
}

@property (nonatomic, retain) NSString *longName;
@property (nonatomic, retain) NSString *shortName;
@property (nonatomic, retain) NSArray *types;

This class maps against what’s returned in version 3 of the geocoding service. It’s just a container class.

 You can grab the sample code from Here

FacebookAgent and iPhone/iPad integration


Today most of the applications we build have a common feature: Socialize! One common way to achieve this my integrating Facebook within the app.For iPhone applications FacebookConnect is the only way to integrate facebook social features. Facebook team has developed a sdk for iPhone. A sample code showing the use and integration of Facebook Connect in your application. This is quite simple and also tons of tutorials, forums, e-books and videos are out here on the web.

Objective: Create a simple view based application and publish a feed using FacebookAgent.

1. Download this folder FacebookAgent.zip.

It also includes facebook connect sdk. So you don’t need to add this sdk elsewhere or even update any project settings for this purpose.

2. Create a new project, name it FacebookAgentTest. Righ click on the project in the XCode and select Add existing files. Add the FacebookAgent Folder to your classes. Check copy the source files.

Add FacebookAgent folder to your project

3.  In the FacebookAgentTestViewController.h, import FacebookAgent.h and implement protocol FacebookAgentDelegate.

@interface FacebookAgentTestViewController : UIViewController {
...

4. Declare a member variable of type FacebookAgent.

FacebookAgent* fbAgent;

5. Open FacebookAgentTest.m and initialize fbAgent in viewDidLoad method.

fbAgent = [[FacebookAgent alloc] initWithApiKey:@"PLACE YOUR FACEBOOK APPLICATION API KEY"
										  ApiSecret:@"PLACE YOUR FACEBOOK APPLICATION API SECRET"
										   ApiProxy:nil];
	fbAgent.delegate = self;

6. Declare an IBAction method in the FacebookAgentTest.h file.

-(IBAction)updateStatus:(id)sender;

7. Define the above method in FacebookAgentTest.m file.

-(IBAction)updateStatus:(id)sender{
}

8. Open FacebookAgentTestViewController.xib and add a button in the view and connect the above method on its touchesUpInside signal.

9. Now just add the following lines in the updateStatus method to publish a feed!

-(IBAction)updateStatus:(id)sender{
[fbAgent publishFeedWithName:@"Hellow world"
					 captionText:@"how are you?"
						imageurl:@"http://amanpages.com/wordpress/wp-content/uploads/2009/12/logo2.png"
						 linkurl:@"http://amanpages.com/"
			   userMessagePrompt:@"What do you think:"];
}

This code will first check if the user is logged in. If logged in it will show the feed dialog.
If the user is not logged in already, first the login dialog will be shown, after logging in, the feed dialog will be shown automatically!

But one minute, there is one require method in the FacebookAgentDelegate protocol. So, you need to define this:

- (void) facebookAgent:(FacebookAgent*)agent loginStatus:(BOOL) loggedIn{
}

Above method is called when the user logs in or logs out of the facebook. If you use any login button which is very likely, you may change the button title here.

10. Try updating your status. For this use this line:

[fbAgent setStatus:@"status from iPhone 1"];

This will first check if the user is logged in. if not logged in, then it will show the login prompt first.
After log in it will check if extended permission is enabled for this app. if not it will show the permission dialog.
Having given the permission, it will change the user status.

BUT.

11. You need to two more FacebookAgentDelegate method if you want to change status:

- (void) facebookAgent:(FacebookAgent*)agent requestFaild:(NSString*) message{
}
- (void) facebookAgent:(FacebookAgent*)agent statusChanged:(BOOL) success{
}

12. Thats all :) Run the app!

You can look into the FacebookAgent.h for more detail. It is well documented. If you still have some question shoot here or drop me mail.
Feel free to use this classes without any restriction but I will appreciate if you let me know in which app you are using it :)

What can be done now using FacebookAgent:
1. Fetch user name:
For this after initialization, set shouldFetchUsernameAfterLogin = YES.

fbAgent.shouldFetchUsernameAfterLogin = YES

and also define the corresponding delegate method:

- (void) facebookAgent:(FacebookAgent*)agent didLoadName:(NSString*) name{
    //use the name
}

2. Make your own attachment and publish a feed.

// this method has some over loaded versions too
- (void) publishFeed:(NSString*)attachement;

3. Publish feed by passing, name, caption, image and link url.

// this method has some over loaded versions too
/**
 * Let the agent make attachement for you. You just pass the information
 *
 */
- (void) publishFeedWithName:(NSString*)name
			 captionText:(NSString*)caption
					   imageurl:(NSString*)url
						linkurl:(NSString*)href
			  userMessagePrompt:(NSString*)prompt;

4. upload a photo

- (void) uploadPhoto:(NSString*)imageurl;

6. ask for extended permission

- (void) askPermission;

7. login and logout

- (void) login;
- (void) logout;

The delegates also offers some handy callback options like:

/**
 * Must define this method if setStatus is called
 *
 * This method is called when user status is changed either successfully or not
 */
- (void) facebookAgent:(FacebookAgent*)agent statusChanged:(BOOL) success;

/**
 * Must define this method if shouldFetchUsernameAfterLogin is set YES
 *
 * This method is called after the agent fetched facebook profile name
 */
- (void) facebookAgent:(FacebookAgent*)agent didLoadName:(NSString*) name;

/**
 * Must define this method if uploadPhoto is called
 *
 * This method is called after photo is uploaded
 */
- (void) facebookAgent:(FacebookAgent*)agent photoUploaded:(NSString*) pid;

/**
 * Must impement this method if any of the above method is defined
 *
 * This method is called if the agent fails to perform any of the above three actions
 */
- (void) facebookAgent:(FacebookAgent*)agent requestFaild:(NSString*) message;

@required

/**
 * This method is called if after login or logout
 */
- (void) facebookAgent:(FacebookAgent*)agent loginStatus:(BOOL) loggedIn;

Here is the demo project. DONT FORGET TO ADD YOUR key and secret!!

 

FacebookAgentTest

Cocoa: Convert number to comma-separated NSString


At some point in your Mac, iPhone, or iPad development you may find the need to express a long number (1000000000) as a comma-separated string (1,000,000,000) to make life easier on your users. The NSNumberFormatter class is a rich tool for converting numbers to strings supporting different types of currencies and localizations. It’s also the perfect class to leverage for our comma-ing task.

First of all, the NSNumberFormatter class works on NSNumber objects, so we need to convert our number to a NSNumber if it’s not there already.
NSNumber *number = [NSNumber numberWithInt:1000000000];

NSNumber also supports floating point values (numberWithFloat) and the regular gang of other number formats.

With our NSNumber in hand, we can get on with the good stuff. NSNumberFormatter supports grouping of numeric digits into arbitrary length groups (we want groups of three) and separating the groups with arbitrary strings (we want to use a comma (@”,”) but we could use any string). Here’s the code that makes our string:

NSNumberFormatter *frmtr = [[NSNumberFormatter alloc] init];
[frmtr setGroupingSize:3];
[frmtr setGroupingSeparator:@","];
[frmtr setUsesGroupingSeparator:YES];
NSString *commaString = [frmtr stringFromNumber:number];

 

How to Generate QR Code using Google Api for iPhone/iPad?


Hi,

I have found one very simple way how to generate QR Code using Google Api.Just take 1 UIWebView in my code I have taken IBOutlet UIWebView *webView; and I want add this Much of Information in My QR Code.

1.Business Name

2.First Name and  Last Name

3.Physical Address and phone

4.Website

I have also taken 1 Button Event named here is QRcodeTapped.I am receiving all the Value from NSDictionary.Please check the bellowed methods.

– (IBAction)QRcodeTapped:(id)sender {

NSLog(@”d==%@”,[d valueForKey:@”QR Business Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR First Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Last Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR  Last Name”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical Address”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical City”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical State”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical Zip”]);

NSLog(@”d==%@”,[d valueForKey:@”QR Physical Zip Plus 4″]);

NSLog(@”d==%@”,[d valueForKey:@”QR Website”]);

//this url has several parameters which is passed here. After that don’t Forget NSUTF8StringEncoding.

NSString *url=[NSString stringWithFormat:@”http://chart.apis.google.com/chart?cht=qr&chs=200×200&chl=MECARD:ORG%@CN%@%@CTEL%@CADR%@%@%@%@%@CEMAIL%@&#8221;,[d valueForKey:@”QR Business Name”],[d valueForKey:@”QR First Name”],[d valueForKey:@”QR Last Name”],[d valueForKey:@”QR Phone”],[d valueForKey:@”QR Physical Address”],[d valueForKey:@”QR Physical City”],[d valueForKey:@”QR Physical State”],[d valueForKey:@”QR Physical Zip”],[d valueForKey:@”QR Physical Zip Plus 4″],[d valueForKey:@”QR Website”]];

url=[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

//Create a URL object.

NSURL *Curl=[NSURL URLWithString:url];

//URL Requst Object

NSURLRequest *request = [NSURLRequest requestWithURL:Curl];

//Load the request in the UIWebView.

[webView loadRequest:request];

}

Grab the Sample Code from Here

Day-10 for iOS Development


click here for Lecture 10 which includes UITableView,UITableViewCell and UITableViewController.