views:

26

answers:

1

Hi all,

I've a tableviewController in a class which I need to present modally from another class. In the modaltableview class, I'm creating tableview in viewDidLoad and apart from this there are tableView delegate methods in this class.

My question is how do I present this class object to show this tableViewController modally? I've presented the viewController from same class as:

  UIViewController *vw = [[UIViewController alloc]init];
  [self presentModalViewController:vw];

But what to write for a viewController from another class? Shall I call presentModalViewController from this class or the modaltableViewControler class?

P.S. I'm having a modalViewController already on the current viewController where I've to present the new modalTableView.

Thanx in advance.

A: 

In the visible view controller, create and initialise an instance of your modal tableViewController. Then, still in the visible view controller, call [self presentModalViewController:<THE TABLE VIEW CONTROLLER YOU JUST INITIALISED> animated:YES];

Hope this helps!
-jrtc27

jrtc27
I've already tried this, but it brings down even my existing modalViewController and doesn't present itself too. Also I tried to display modaltableView on the existing modalView. What I did is: [displayController prsentModalViewController:modalTableView animated:YES]; where displayController is my existing modalviewcontroller and in tableview class I created and added tableview to self [self.view addSubview:modaltableView.view animated:YES]; But the view isn't showing up. Am I doing something wrong?
neha