Dear All
In my sample project for iPad, I am using uisplitviewcontroller and further , uinavigationcontroller in root view controller (left panel of split view pane) so that on tapping the disclosure button of main table, next view (uitableview) comes up.
Logic is simple that I should push the object of next view class to navigation controller. But I dont understand where I am lacking.
Navigation_TestAppDelegate.m
RootViewController.m is:
and didSelectRowAtIndexPath method (of RootViewController.m)is:
I am unable to understand that on tapping cell of root view controller, why nextview is not visible.
In my sample project for iPad, I am using uisplitviewcontroller and further , uinavigationcontroller in root view controller (left panel of split view pane) so that on tapping the disclosure button of main table, next view (uitableview) comes up.
Logic is simple that I should push the object of next view class to navigation controller. But I dont understand where I am lacking.
Navigation_TestAppDelegate.m
Code:
@synthesize window, splitViewController, rootViewController, detailViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UINavigationController *rootNav = [[UINavigationController alloc] initWithRootViewController:rootViewController];
splitViewController.viewControllers = [NSArray arrayWithObjects:rootNav,detailViewController,nil];
splitViewController.delegate = detailViewController;
[window addSubview:splitViewController.view];
[window makeKeyAndVisible];
[rootNav release];
return YES;
}
RootViewController.m is:
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
}
cell.textLabel.text = [NSString stringWithFormat:@"Row %d", indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
return cell;
}
and didSelectRowAtIndexPath method (of RootViewController.m)is:
Code:
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
_nav= [[nextview alloc] initWithStyle:UITableViewStylePlain];
// _nav is object of class nextview (uitableviewcontroller type)
[self.navigationController pushViewController:_nav animated:YES];
}
I am unable to understand that on tapping cell of root view controller, why nextview is not visible.
Last edited: