
November 13th, 2010, 11:49 AM
|
 |
Trying to improve
|
|
Join Date: Apr 2003
Location: Helsingborg, Sweden
Posts: 237
Time spent in forums: 3 Days 10 h 4 m 57 sec
Reputation Power: 11
|
|
|
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:
Original
- Objective C Code |
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(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:
Original
- Objective C Code |
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(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.
|