Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9041639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:17:13+00:00 2026-06-16T10:17:13+00:00

I want to present a custom-sized modal view controller with animation from the bottom.

  • 0

I want to present a custom-sized modal view controller with animation from the bottom. I can achieve this animation with ModalPresentationStyle to FormSheet, but it forces me to use the default size which is 540×620 and my view doesn’t fit.

How do I make perform a similar transition to an arbitrarily sized view (controller) placed in center of the screen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T10:17:14+00:00Added an answer on June 16, 2026 at 10:17 am

    I didn’t find a way to do it from the modal controller itself so I created a class and an extension method:

    public class ModalViewController : UIViewController
    {
        public SizeF OriginalViewSize { get; private set; }
    
        void Initialize ()
        {
            ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
        }
    
        public override void ViewDidLoad ()
        {
            OriginalViewSize = View.Bounds.Size;
            base.ViewDidLoad ();
        }
    
        public ModalViewController (IntPtr handle) : base (handle)
        {
            Initialize ();
        }
    
        public ModalViewController (string nibName, NSBundle bundle) : base (nibName, bundle)
        {
            Initialize ();
        }
    
        public ModalViewController () : base ()
        {
            Initialize ();
        }
    }
    
    public static class ModalViewControllerExtensions
    {
        public static void PresentModalViewController (this UIViewController parent, ModalViewController target)
        {
            parent.PresentViewController (target, true, null);
    
            target.View.Superview.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
            target.View.Superview.Frame = new RectangleF (PointF.Empty, target.OriginalViewSize);
            target.View.Superview.Center = UIScreen.MainScreen.Bounds.Center ().Rotate ();
        }
    }
    

    This is roughly how I use it:

    this.PresentModalViewController (
        new PublishModalViewController (Item, HandlePublishAction)
    );
    

    It is convenient that I don’t need to specify the size explicitly because it uses root View’s bounds from the interface builder. I’m not sure how this reacts to autorotate, it may need some tuning. I’m also using two extension methods here:

    public static PointF Rotate (this PointF pt)
    {
        return new PointF (pt.Y, pt.X);
    }
    
    public static PointF Center (this RectangleF rect)
    {
        return new PointF (
            (rect.Right - rect.Left) / 2.0f,
            (rect.Bottom - rect.Top) / 2.0f
            );
    }
    

    And this is it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a simple question Currently i present a modal view like this: + (void)showModalController:(id)ContentController
i have a custom UIView which is presented from a UIViewController . This view
I have a custom view which I present with animation giving a bouncing effect.
I have a dilema, I want to present to the user a semi-transparent view.
I have seen several examples how to present a custom UIStoryboardSegue with custom animation.
I got stuck in here, I have a custom scrollview in a view this
I have my own custom control derived from System.Windows.Forms.TreeView which is present on the
I want to apply scope limiter in my custom validation I have this Product
I took most of this code from jQuery UI documentation. I want to add
I want to set up a WCF that can be called by AJAX from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.