#1
  1. Trying to improve
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    Helsingborg, Sweden
    Posts
    237
    Rep Power
    12

    TableViewCell pointing to a specific nib (xib)


    Hey!

    I'm making a simple tableView app and I'm totally new to objective C.

    My question is: How do I setup a single cell to go to a preferred view ?
    My code at the moment forwards me to the same nib, no matter what cell I'm pressing/tapping...

    Code:
    Objective C Code:
    - (void)tableView<img src="http://images.devshed.com/fds/smilies/frown.gif" border="0" alt="" title="Frown" class="inlineimg" />UITableView *)tableView didSelectRowAtIndexPath<img src="http://images.devshed.com/fds/smilies/frown.gif" border="0" alt="" title="Frown" class="inlineimg" />NSIndexPath *)indexPath {
     
    	 rothTools *tools = [[rothTools alloc] initWithNibName:@"rothTools" bundle:nil];
     
    	tools.currentItem = @"Second View";
     
    	[self.navigationController pushViewController:tools animated:YES];
    	[tools release];
    }


    edit:
    Got two views working now but the hierachy is wrong!
    The app ends up on "page 3" when clicking a tableCell

    Code:
    Objective C Code:
    - (void)tableView<img src="http://images.devshed.com/fds/smilies/frown.gif" border="0" alt="" title="Frown" class="inlineimg" />UITableView *)tableView didSelectRowAtIndexPath<img src="http://images.devshed.com/fds/smilies/frown.gif" border="0" alt="" title="Frown" class="inlineimg" />NSIndexPath *)indexPath {
     
    	rothTools *tools = [[rothTools alloc] initWithNibName:@"rothTools" bundle:nil];
    	rothEmployees *employees = [[rothEmployees alloc] initWithNibName:@"rothEmployees" bundle:nil];
     
    	tools.currentItem = @"Employees";
    	employees.currentItem = @"En ny sida";
     
    	[self.navigationController pushViewController:tools animated:YES];
    	[self.navigationController pushViewController:employees animated:YES];
    	[tools release];
    	[employees release];
    }


    I added : self.title in viewDidLoad and that works, but the hierarchy is wrong

    Thankful for any answer.
    Regards!
    Last edited by mrsarun; November 13th, 2010 at 12:35 PM.

IMN logo majestic logo threadwatch logo seochat tools logo