- I am using split view controller in my project,
- in the split view i have RootViewCotroller (left),
DetaolsViewConroller (right). - In the Root view controller, I have 3 rows.
- Now I want different type of appearance in details view, when
selecting different rows in rootview. - …
- in Details view:
- 1.Display a tableView when select the row1.
- 2.Dispaly a text field when select the row2.
- 3.Image view when select row3 from rootviewcontroller.
- ..
- I wrote the code like this in RootViecontroller, but no change in
detailsView.
–
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
RightViewController *rightViewController = [[RightViewController alloc] initWithNibName:@"RightViewController"bundle:nil];
//[self.navigationController pushViewController:rightViewController animated:YES];
if(indexPath.row == 0)
{
UILabel *infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 450, 150)];
infoLabel.text = @"Customer:Barrick \r\n Mine:gold \r\n Location:USA";
[rightViewController.view addSubview:infoLabel];
UITableView *mapTable = [[UITableView alloc]initWithFrame:CGRectMake(165, 5, 450,150)style:UITableViewStyleGrouped];
[rightViewController.view addSubview:mapTable];
}
if(indexPath.row == 1)
{
UILabel *infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 450, 150)];
infoLabel.text = @"Eqipement";
[rightViewController.view addSubview:infoLabel];
}
if(indexPath.row == 2)
{
image view..
}
[rightViewController release];
}
- what to do..? Thanks in advance.
You have to pass a value to the right view controller and you have to also set delegate for your right view controller.
Define your right View Controller in your left view controller like:
Define in your rightViewController.h file :
In Your RightViewController’s implementation file: