learner2010
learner2010

Reputation: 4167

Problem using presentModalViewController in Ipad

In my current Ipad app, I have a split screen view in which the detail view is a scroll view containing 4 table views. The functionality I was trying to achive was that when I click any row of the table in the scroll view, a screen is show containing additional information and I used presentModalViewController to try to get this functionality.

say for example, I have 3 files aViewController, bViewController, cViewController.. I am writing the code for splitViewController in the appDelegate file of my project and I keep the 3 view Controllers (aViewController, bViewController, cViewController) as subviews of the splitViewController...

Now in one of my ViewControllers, say aViewController, in its didSelectRowAtIndexPath, I add the code as follows

This is what I did,

PopOverControllerContents *popContents = 
        [[PopOverControllerContents alloc] 
         initWithNibName:@"PopOverControllerContents" 
         bundle:[NSBundle mainBundle]];
 popContents.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:popContents animated:YES

An important thing I want to mention is that, my app's default orientation is landscape mode and hence I changed the orientation of PopOverControllerContents to landscape orientation.

When I build and run and when I click any row in aViewController, a popup view does come but its totally out of position and its bottom part gets cut off.

Would anyone be able to tell me what I am doing wrong and How I can correct it?

Upvotes: 3

Views: 1378

Answers (1)

Sulthan
Sulthan

Reputation: 130082

[UIViewController presentModalViewController::] supposes that your view controller is the root controller or it is somewhere in the controller hierarchy. When you say that your controller views are subview of a SplitViewController are they also its child controllers? You should try to present the modal controller from the SplitViewController or check that you controllers are it's child controllers (new feature in iOS 5).

Upvotes: 2

Related Questions