Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-11-2009, 11:47 AM   #6 (permalink)
lajloos
New Member
 
Join Date: Mar 2009
Posts: 35
Default

I've used some methods from this tutorial:
Parsing XML Files - iPhone SDK Articles

It's a xml listed with boats and the method looks like this:
I don't use any array to return.

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }
	
			
	Boat *newBoat = [appDelegate.boats objectAtIndex:indexPath.row];
	
	cell.text = newBoat.model;
	cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
	
    // Set up the cell
    return cell;
	
}
This if a function in AppDelegate.m
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
	                                             
	NSString *xmlStart = @"http://www.mysite.com/search="; 	
	NSString *searchWord = passedString; 
	NSString *xmlEnd = @"&xml=1";
	
	NSString *newString;
	newString = [xmlStart stringByAppendingString:searchWord];	
	XML = [newString stringByAppendingString:xmlEnd];
	

	NSURL *url = [[NSURL alloc] initWithString:XML];
	NSXMLParser *boatListParser = [[NSXMLParser alloc]       initWithContentsOfURL:url];
	
	BoatListParser *parser = [[BoatListParser alloc] initBoatListParser];
	[boatListParser setDelegate:parser];
	
	BOOL success = [boatListParser parse];
	
	if(success)
		NSLog(@"Success");
	else
		NSLog(@"Error");
	
	// Configure and show the window
	[window addSubview:[navigationController view]];
	[window makeKeyAndVisible];
}

Last edited by lajloos; 03-11-2009 at 11:56 AM.
lajloos is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,847
Threads: 89,213
Posts: 380,661
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Leroy2027
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:37 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.