present modal view smaller than the size of the screen

Discussion in 'iOS Programming' started by manman, Sep 15, 2008.

  1. manman macrumors regular

    Joined:
    Aug 18, 2008
    #1
    I'm trying to emulate the behavior that happens when you try to delete an email or contact. It looks like a view comes up with the buttons "save" and "cancel", but the view is slightly transparent and it only takes up a small part of the bottom of the screen, as opposed to fully covering the view it pops over. Also, the view behind it fades to a darker color (I don't need to do that part if it's difficult)

    Here's what I've tried so far-

    create a vew with a hight shorter than the screen. Set it's background color to black at about 70% opacity. Also set the view's opaque property to NO. (i'm doing this in IB). I also set the view to center instead of "scale to fill"

    I also tried making a full sized view, totally transparent, but with a semitransparent UIImageView smaller than the view.

    In both cases I show the view by calling presentModalView. In the first case, even though the view is smaller than the screen size, and set to 'center', it still fills up the entire screen when it comes up. And in both cases the view is transparent during the transition but when it is up fully it goes back to being opaque.

    Can anyone give me some tips as to what i'm doing wrong, or how I can achieve the effect I'm looking for? Thanks
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    I'm pretty sure that you can't use presentModalView or pushViewController. I've spent some time fooling around with this and couldn't get that to work. I think those methods just don't want to allow you to have a transparent view that is frontmost.

    Instead I think you need to do the animations yourself. I've attached a project that kind of does this.
     

    Attached Files:

  3. manman thread starter macrumors regular

    Joined:
    Aug 18, 2008
    #3
    hey, thanks a lot for the help man. I'll check out your code now and get back to you. btw, I like the screen name, haha. :D
     

Share This Page