Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sagarshivam

macrumors member
Original poster
May 24, 2011
51
0
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
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:

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
In the code you showed us, _nav isn't declared anywhere. I believe you want it to be a pointer to a UITableView... did you declare it as such in your header file, perchance? It's also possible that the _ character does something special that I'm simply not aware of.

Also, you have "nextview". Is that a custom class? You haven't shown us your .h and .m for it.
 

sagarshivam

macrumors member
Original poster
May 24, 2011
51
0
_nav is declared properly. And nextview class is a standard UItableviewcontroller type.

When I am using the same way of pushing the other uitableviewcontroller class object (in my case it is _nav) in root viewcontroller without using uisplitviewcontroller, everything works fine.

Any suggestions?
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
You should probably follow standard naming conventions and rename your nextview class using "camel-case" (i.e. something like NextTableViewController. It will make things less confusing to those trying to help (or those having to maintain your code in the future).
 

sagarshivam

macrumors member
Original poster
May 24, 2011
51
0
Thanks all

I was making some mistakes in delegate class. Its working fine now. Thanks for all the support and sugegstion
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.