- Joined
- Jun 3, 2011
- Messages
- 54
- Reaction score
- 0
- Points
- 6
Dear All
Being a newbie, I divided my application into small separate application and they all worked fine. now when I am trying to integrate, problem arises.
I am trying to post some part of the project's code where I am facing the real problem. May be my fundamentals are wrong. But plz help, I am ready to work on it.
SimpleTableViewAppDelegate.h
SimpleTableViewAppDelegate.m
RootViewCOntroller.m
XML_Parse.m
Queries:
1. In split view, navigation controller is not visible. Only root view and detail view are visible (and so even after pushing object of SubTable class, its not visible.).
2. I am trying to call 'xmlparse' method (which again invokes 2 nested methods) defined in XML_Parse class but Its not getting accessed from inside SimpleTableViewAppDelegate.m
(Getting warning as:"warning: 'XML_Parse' may not respond to '-xmlparse' ")
XMLparsing code is correct as it is working good when tested separately.
Being a newbie, I divided my application into small separate application and they all worked fine. now when I am trying to integrate, problem arises.
I am trying to post some part of the project's code where I am facing the real problem. May be my fundamentals are wrong. But plz help, I am ready to work on it.
SimpleTableViewAppDelegate.h
Code:
@class RootViewController;
@class DetailViewController;
@interface SimpleTableViewAppDelegate: NSObject <UIApplicationDelegate> {
UIWindow *window;
UISplitViewController *splitViewController;
RootViewController *rootViewController;
DetailViewController *detailViewController;
UINavigationController *rootNav;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController;
@property (nonatomic, retain) IBOutlet RootViewController *rootViewController;
@property (nonatomic, retain) IBOutlet DetailViewController *detailViewController;
@property (nonatomic, retain) IBOutlet UINavigationController *rootNav;
@end
SimpleTableViewAppDelegate.m
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain];
rootNav=[[UINavigationController alloc]initWithRootViewController:rootViewController];
splitViewController.viewControllers=[NSArray arrayWithObjects:rootNav,detailViewController,nil];
splitViewController.delegate=detailViewController;
[window addSubview:splitViewController.view];
XML_Parser *xmlp =[[XML_Parser alloc] init];
[xmlp xmlparse];
[window makeKeyAndVisible];
}
RootViewCOntroller.m
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
}
// Set up the cell.
NSString *timeZoneName = [timeZoneNames objectAtIndex:indexPath.row]; // timeZoneNames is defined in this class.
cell.textLabel.text = timeZoneName;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SubTable *r1 = [[SubTable alloc] initWithStyle:UITableViewStylePlain];
r1.timevalue = timeZoneNames; // timevalue is an array in SuBTable class
[self.navigationController pushViewController:r1 animated:YES];
[r1 release];
}
XML_Parse.m
Code:
@interface XML_Parse ()
- (void) xmlparse;
- (void) traverseElement:(TBXMLElement *)element;
- (void) list_of_sub_projects:(NSMutableArray *)list_array;
@end
@implementation XML_Parse
@synthesize data_array,sub_project_name,dict_storage;
@synthesize file_array,sub_project_array;
- (void) xmlparse {
NSString *xml_name = @"dv_prescribed_format.xml";
TBXML *tbxml = [[TBXML alloc] initWithXMLFile:xml_name];
TBXMLElement *root = tbxml.rootXMLElement;
data_array = [NSMutableArray array];
[data_array retain];
if (tbxml.rootXMLElement) {
data_array=[self traverseElement:root];
[tbxml release];
}
[self list_of_sub_projects:data_array]; //getting warning here //XML_Parse may not respond to list_of_sub_projects
}
- (void) traverseElement:(TBXMLElement *) element{
do {
if ([[TBXML elementName:element] isEqualToString:@"subproject"]){
NSString *break_point=@"break";
[data_array addObject:break_point];
TBXMLElement *sub_project_name_xml = [TBXML childElementNamed:@"subprojectname" parentElement:element];
NSString *detail1= [TBXML textForElement:sub_project_name_xml];
[data_array addObject:detail1] ;
}
if (element->firstChild)
[self traverseElement:element->firstChild];
if ([[TBXML elementName:element] isEqualToString:@"docid"]) {
TBXMLElement *filename = [TBXML childElementNamed:@"Fname" parentElement:element];
NSString *detail = [TBXML textForElement:filename];
[data_array addObject:detail];
}
} while ((element = element->nextSibling));
}
- (void) list_of_sub_projects:(NSMutableArray *) list_array {
dict_storage = [[NSMutableDictionary alloc] initWithCapacity:10];
file_array = [[NSMutableArray alloc] init];
sub_project_array = [[NSMutableArray alloc] init];
int j=0,temp=0,temp1,i=1;
while (i< [list_array count]) {
if ([[list_array objectAtIndex:i] isEqualToString:@"break"])
{
temp1=temp;
temp=i;
for (j=temp1+2; j<temp; j++) {
[file_array addObject:[list_array objectAtIndex:j]];
}
sub_project_name = [list_array objectAtIndex:temp1+1];
[sub_project_array addObject:sub_project_name];
[dict_storage setObject:file_array forKey:sub_project_name];
[dict_storage allKeys];
[file_array removeAllObjects];
}
i++;
}
}
Queries:
1. In split view, navigation controller is not visible. Only root view and detail view are visible (and so even after pushing object of SubTable class, its not visible.).
2. I am trying to call 'xmlparse' method (which again invokes 2 nested methods) defined in XML_Parse class but Its not getting accessed from inside SimpleTableViewAppDelegate.m
(Getting warning as:"warning: 'XML_Parse' may not respond to '-xmlparse' ")
XMLparsing code is correct as it is working good when tested separately.