programming4us
programming4us
MOBILE

iPhone SDK 3 Programming : XML Processing - An RSS Reader Application

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

In this section, we present a working iPhone application based on the code developed so far. The application will present the contents of an RSS feed to the user in a scrollable table view. The complete application can be found in the RSS Reader project in the source downloads.

Listing 1 shows the application delegate declaration and definition. The application delegate uses an instance of the class XORSSFeedNebraska to retrieve the XML document and parse it to generate the items.

Example 1. The RSS reader application delegate declaration and definition.
#import  <UIKit/UIKit.h>
#import "XORSSFeedNebraska.h"
@interface XORSSFeedAppDelegate : NSObject {
UIWindow *window;
UINavigationController *navigationController;
XORSSFeedNebraska *rssFeed;
}
@property (nonatomic, retain)
UINavigationController *navigationController;
@end

#import "XORSSFeedAppDelegate.h"
#import "XORSSFeedNebraska.h"
#import "RootViewController.h"

@implementation XORSSFeedAppDelegate
@synthesize navigationController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
window =
[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Create the navigation and view controllers
RootViewController *rootViewController =
[[RootViewController alloc] init];
UINavigationController *aNavigationController =
[[UINavigationController alloc]
initWithRootViewController:rootViewController];



self .navigationController = aNavigationController;
[aNavigationController release];
[rootViewController release];
// Configure and show the window
[window addSubview:[navigationController view]];
rssFeed = [[XORSSFeedNebraska alloc] init];
[rssFeed fetchAbsconders];
[window makeKeyAndVisible];
}
-(NSString*)xoTitle{
return @"Nebraska Absconders";
}
- (NSInteger)countOfList {
return [rssFeed numberOfAbsconders];
}
- (id )objectInListAtIndex:(NSUInteger)theIndex {
return [rssFeed absconderAtIndex:theIndex];
}
- (void )dealloc {
[window release];
[navigationController release];
[rssFeed release];
[super dealloc];
}
@end


The delegate's applicationDidFinishLaunching: method creates a window and the table view controller. It then asks the instance of XORSSFeedNebraska to fetch the XML and parse it by calling the fetchAbsconders method. The table view controller's declaration and definition are shown in Listing 2.

Example 2. The RSS reader table controller declaration and definition.
#import <UIKit/UIKit.h>
@interface RootViewController : UITableViewController {
}
@end

#import "RootViewController.h"
#import "XOAbsconder.h"
#import "XORSSFeedAppDelegate.h"
@implementation RootViewController
- init {
if (self = [super init]) {
XORSSFeedAppDelegate *appDelegate =
(XORSSFeedAppDelegate*)[[UIApplication sharedApplication] delegate];
self.title = [appDelegate xoTitle];
}


return self;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section {
XORSSFeedAppDelegate *appDelegate =
(XORSSFeedAppDelegate*)[[UIApplication sharedApplication] delegate];
return [appDelegate countOfList];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:@"XO"];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"XO"] autorelease];
}
XORSSFeedAppDelegate *appDelegate =
(XORSSFeedAppDelegate*)[[UIApplication sharedApplication] delegate];
XOAbsconder *absconder =
[appDelegate objectInListAtIndex:indexPath.row];
cell.textLabel.text = [absconder description];
return cell;
}
@end

Other  
  •  iPhone SDK 3 Programming : XML Processing - Simple API for XML (SAX)
  •  iPhone SDK 3 Programming : XML Processing - Document Object Model (DOM)
  •  iPhone SDK 3 Programming : XML and RSS
  •  Windows Phone 8 : Making Money - Modifying Your Application, Dealing with Failed Submissions, Using Ads in Your Apps
  •  Windows Phone 8 : Making Money - Submitting Your App (part 3) - After the Submission
  •  Windows Phone 8 : Making Money - Submitting Your App (part 2) - The Submission Process
  •  Windows Phone 8 : Making Money - Submitting Your App (part 1) - Preparing Your Application
  •  Windows Phone 8 : Making Money - What Is the Store?
  •  BlackBerry Push APIs (part 3) - Building an Application that Uses the BlackBerry Push APIs - Checking the Status of a Push Request and Cancelling a Push Request
  •  BlackBerry Push APIs (part 2) - Building an Application that Uses the BlackBerry Push APIs - Unsubscribing From the Push System, Pushing Data to a Subscriber
  •  
    Top 10
    Free Mobile And Desktop Apps For Accessing Restricted Websites
    MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
    TOYOTA CAMRY 2; 2.5 : Camry now more comely
    KIA SORENTO 2.2CRDi : Fuel-sipping slugger
    How To Setup, Password Protect & Encrypt Wireless Internet Connection
    Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
    Backup & Restore Game Progress From Any Game With SaveGameProgress
    Generate A Facebook Timeline Cover Using A Free App
    New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    - Messages forwarded by Outlook rule go nowhere
    - Create and Deploy Windows 7 Image
    - How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
    - Creating and using an unencrypted cookie in ASP.NET
    - Directories
    - Poor Performance on Sharepoint 2010 Server
    - SBS 2008 ~ The e-mail alias already exists...
    - Public to Private IP - DNS Changes
    - Send Email from Winform application
    - How to create a .mdb file from ms sql server database.......
    programming4us programming4us
    programming4us
     
     
    programming4us