-(id)init{ self = [super init]; if(self!=nil){ self.title = @"More"; } return self; } /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */
// Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { [super loadView]; if ([appList count] == 0) {
/* // make the activity indicator as the right side button CGRect frame = CGRectMake(0.0, 0.0, 25.0, 25.0); activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:frame]; [activityIndicator startAnimating]; [activityIndicator sizeToFit]; activityIndicator.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);
-(void) parseXMLFileAtURL:(NSString*)URL{ appList = [[NSMutableArray alloc]init]; //you must then convert the path to a proper NSURL or it won't work NSURL *xmlURL = [NSURL URLWithString:URL];
// here, for some reason you have to use NSClassFromString when trying to alloc NSXMLParser, otherwise you will get an object not found error // this may be necessary only for the toolchain xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL];
// Set self as the delegate of the parser so that it will receive the parser delegate methods callbacks. [xmlParser setDelegate:self];
// Depending on the XML document you're parsing, you may want to enable these features of NSXMLParser. [xmlParser setShouldProcessNamespaces:NO]; [xmlParser setShouldReportNamespacePrefixes:NO]; [xmlParser setShouldResolveExternalEntities:NO];
[xmlParser parse]; }
- (void)parserDidStartDocument:(NSXMLParser *)parser { NSLog(@"found file and started parsing"); }
- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError { NSString * errorString = [NSString stringWithFormat:@"Unable to download story feed from web site (Error code %i )", [parseError code]]; NSLog(@"error parsing XML: %@", errorString);
//NSLog(@"ended element: %@", elementName); if ([elementName isEqualToString:@"app"]) { // save values to an item, then store that item into the array... [item setObject:name forKey:@"name"]; [item setObject:description forKey:@"description"]; [item setObject:picurl forKey:@"picurl"]; [item setObject:url forKey:@"url"];