Problem using presentModalViewController in Ipad

Discussion in 'iOS Programming' started by ashwinr87, Apr 11, 2011.

  1. macrumors member

    Joined:
    Mar 9, 2011
    #1
    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,
    Code:
    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?
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  3. thread starter macrumors member

    Joined:
    Mar 9, 2011
    #3
    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?

     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    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?
     
  5. thread starter macrumors member

    Joined:
    Mar 9, 2011
    #5
    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)...

     
  6. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    So it's the table views delegate, which is, as you point out the controller class. Not the table view at all.
     
  7. thread starter macrumors member

    Joined:
    Mar 9, 2011
    #7
    thanks for pointing out that for me.. would you be able to tell me how to solve my problem?

     
  8. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #8
    What is the modalPresentationStyle?

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

     
  9. ashwinr87, Apr 11, 2011
    Last edited: Apr 11, 2011

    thread starter macrumors member

    Joined:
    Mar 9, 2011
    #9
    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

     

Share This Page