PDA

View Full Version : Problem using presentModalViewController in Ipad




ashwinr87
Apr 11, 2011, 12:55 PM
Hi,

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.

The problem I am having is that the view does show up when the table row is clicked, but it comes up behind my scroll view because I can see a part of the view at the sides of my scroll view...

This is what I did,
PopOverControllerContents *popContents =
[[PopOverControllerContents alloc]
initWithNibName:@"PopOverControllerContents"
bundle:[NSBundle mainBundle]];
[self presentModalViewController:popContents animated:YES];

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



dejo
Apr 11, 2011, 01:14 PM
What is self in your code snippet?

ashwinr87
Apr 11, 2011, 01:17 PM
self is the table view in which the row is clicked...
after doing some searching, I saw that the presentModalViewController would work properly if the view is got in as a subview of the rootview controller...

so does this mean that since my scrollview would be the root controller, I should get the modal view on the scrollview?
How would I do that?

What is self in your code snippet?

robbieduncan
Apr 11, 2011, 01:33 PM
self is the tableview? Are you sure? That implies you have subclasses UITableView for some reason. Are you sure you don't mean it's the controller for that table view?

ashwinr87
Apr 11, 2011, 01:39 PM
I think it is the tableview because I write this code inside the didSelectRowAtIndexPath function of one of the files ( which is a UIView controller subclass)...

self is the tableview? Are you sure? That implies you have subclasses UITableView for some reason. Are you sure you don't mean it's the controller for that table view?

robbieduncan
Apr 11, 2011, 01:40 PM
I think it is the tableview because I write this code inside the didSelectRowAtIndexPath function of one of the files ( which is a UIView controller subclass)...

So it's the table views delegate, which is, as you point out the controller class. Not the table view at all.

ashwinr87
Apr 11, 2011, 01:42 PM
thanks for pointing out that for me.. would you be able to tell me how to solve my problem?

So it's the table views delegate, which is, as you point out the controller class. Not the table view at all.

robbieduncan
Apr 11, 2011, 01:46 PM
What is the modalPresentationStyle?

From the documentation (which I expect you read, right?):

On iPhone and iPod touch devices, the view of modalViewController is always presented full screen. On iPad, the presentation depends on the value in the modalPresentationStyle property.

ashwinr87
Apr 11, 2011, 01:53 PM
thank you very much... I was using only UIModalPresentationFullScreen because that was the only option coming on the auto complete.. I thought UIModalPresentationFormSheet was not available..
When is used UIModalPresentationFormSheet, it works...

One last question is whether I will be able to move the position of the popped up view, because I changed the orientation to landscape since my apps orientation is landscape... the view pops up correctly but its a bit out of position and I was wondering if there is any way to bring it to a position I need or atleast to a position in the middle of the screen

What is the modalPresentationStyle?

From the documentation (which I expect you read, right?):