modal UIViewController that doesnt cover all screen

Discussion in 'iOS Programming' started by drivefast, Sep 26, 2009.

  1. drivefast macrumors regular

    Mar 13, 2008
    i need a parent view controller to load a modal view controller, such that only the bottom of the screen is covered by the modal's view. with the normal invocation, the modal's view is resized to be as high as the screen (460px) and slides all the way to the top. i tried forcing the size and the y origin back to what i need in viewDidLoad and viewWillAppear: with no effect. if i force the origin in viewDidAppear: (which is not really desirable - it's too late by then) the view does come back to where i want it, but instead of the parent's view contents that i want on top, i get the contents of whatever would be underneath that parent's view. how would i do that? it should be simple, but i guess i'm missing something...

    to make it easier, imagine that what i want to achieve is a UIActionSheet, except that it has my own contents, not just a few buttons.

  2. PhoneyDeveloper macrumors 68030


    Sep 2, 2008
    What you've discovered is the way it is. If you want a part screen view you need to add it yourself and animate it in yourself. Create the view with an offscreen center and animate the center on screen and then offscreen, kind of like how the keyboard works. You can have the view be full screen but have an alpha so it's transparent. AddSubview the view to the window or to your current main view.
  3. drivefast thread starter macrumors regular

    Mar 13, 2008
    thats kind of how i have it right now - i instantiate the view controller then add its subview to the current view. problem is that the view controller that would want the modal is actually part of a tab bar controller, and the tab bar still remains displayed at the bottom. tapping on the tab bar is still possible, obviously screws up everything, and this setup doesnt look modal at all... :(

    i'll keep wrestling it and let you guys know if i found a solution.

Share This Page