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 7189985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:25:04+00:00 2026-05-28T19:25:04+00:00

I want to show a modal UIViewController with a custom frame in iPad, centered

  • 0

I want to show a modal UIViewController with a custom frame in iPad, centered on top of its parent view controller.

I tried using a form sheet but as far I know the frame and shadow effect can’t be changed.

vc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:cv animated:YES];

I also tried using a popover but as far as I know either I can’t center it or I can’t hide the arrow.

Is there another way to show modal view controllers? Is it possible to solve this problem by using form sheets or popovers?

  • 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-05-28T19:25:06+00:00Added an answer on May 28, 2026 at 7:25 pm

    There is no official way to do this however you can get the desired behavior by writing a custom view which keeps a reference or delegate to interact with its presenting view controller and adding it to the view hierarchy. To really get the modal feel you can also place a transparent overlay over the presenting controller just below your ‘modal’ view. I have done this in a number of apps and it usually works out great. You will likely need to make the custom overlay view so you can intercept touches and more elegantly animate its presentation.

    My transparent overlay is usually something like this:

    @protocol TransparentOverlayDelegate <NSObject>
    
    @optional
    - (void)transparentOverlayWillDismiss:(TransparentOverlay *)backgroundTouch;
    - (void)transparentOverlayDidDismiss:(TransparentOverlay *)backgroundTouch;
    @end
    
    
    @interface TransparentOverlay : UIView {
    
        id<TransparentOverlayDelegate> _delegate;
        UIView *_contentView;
        CGFloat _pAlpha;
    }
    
    @property(nonatomic, assign) id<TransparentOverlayDelegate> delegate;
    @property(nonatomic, retain) UIView *contentView;
    @property(nonatomic, assign) CGFloat pAlpha;
    
    - (void)presentTransparentOverlayInView:(UIView *)view;
    - (void)dismissTransparentOverlay:(BOOL)animated;
    

    My custom modal view is usually something like this:

    @protocol ModalViewDelegate <NSObject>
    - (void)performSelectorOnDelegate:(SEL)selector;
    @end
    
    @interface ModalView : UIView {
        id<ModalViewDelegate> _delegate;
    }
    
    @property(nonatomic, assign) id<ModalViewDelegate> delegate;
    

    In my presenting view controller I would usually do the following :

    - (void)presentModalController {
        TransparentOverlay *to = [[[TransparentOverlay alloc] initWithFrame:self.view.bounds] autorelease];
        to.delegate = self;
    
        ModalView *mv = [[ModalView alloc] initWithFrame:CGRectMake(500, 500, 300, 300)];
        mv.delegate = self;
    
        to.contentView = mv;
        [mv release];
    
        [to presentTransparentOverlayInView:self.view]; 
    }
    

    Using the delegates defined on the two classes gives me pretty much open access to manipulate my presenting controller as well as my presentation and dismissal as desired. The only downside to this is when it is used on a view with a NavigationBar, as the bounds of the presenting controller’s view will not contain the bounds of the NavigationBar leaving it open for interaction, there are ways to get around this but not of them are very pretty (adding to the navigation controller’s view is one option).

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

Sidebar

Related Questions

i want to show my view as a model view. In iPad there are
I want to use presentModalViewController to show ABPeoplePickerNavigationController. But the modal controller appears in
I want to show a modal dialog/pop-up window when the user has not filled
I want to show a chromeless modal window with a close button in the
How do I show a help popup window on the iPad? I want to
When window A is show, I want to show another none-modal popup window B,
I want to show a jquery dialog next to a button when its clicked.
I have a modal created using Twitter Bootstrap. I want to open using javascript.
Is it possible to display a modal view over the top of a UIWebView?
I am using nyroModal to show a modal window. It works fine when the

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.