Question

Note: Using Monotouch and doing all the UI Programatically.

Hello everybody,

I have a question.

I have this main UIViewController object, and I have 2 UIVIews inside it. This views will perform commands in some devices, etc. I'm planning to do some menu with a slider effect appearing from the left side as it's drawn below. In this menu the user will select some buttons, and this is gonna make to change the another two UIViews.

Here's my question:

I'm planning to use Modal View Controller as UIModalPresentationPageSheet, but how can It appear at the center of the screen horizontaly. I'd like to put it on the center on the left side. How can I change it?

If it's impossible, should I use the UIPopover?

Image Below

enter image description here

Thank you.

Lyniker

Was it helpful?

Solution

I don't think either will get you the animation effect you want. In general I would choose to slide in a view using UIView animation:

if(IsDrawerVisible == false) {
    UIView.Animate(0.5, () => {

        DrawerView.Frame = new RectangleF(
            this.View.Bounds.Left + 300, 
            DrawerView.Frame.Y, 
            DrawerView.Frame.Width, 
            DrawerView.Frame.Height);

    }, UIViewAnimationOptions.CurveEaseIn); 
}
else {
    // Move the frame of the DrawerView by subtracting from Frame.X
}

Of course you need a reference point (usually the parent UIView's left bounds) and do the appropriate calculations to move the "Drawer" component into view. This can be arbitrary though :-)

NOTE: If DrawerView is of type UIViewController / DialogViewController please use the new iOS 5 custom containment APIs or you'll get some seriously wonky behavior. See my blog post on child view controllers here:

http://blog.devnos.com/wont-somebody-please-think-of-the-children

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top