I am using following code for displaying a Screen/View Controller.
SearchParams *nxt=[[SearchParams alloc] initWithNibName:#"SearchParams" bundle:nil];
UINavigationController *nvc=[[UINavigationController alloc] initWithRootViewController:nxt];
nvc.modalPresentationStyle=UIModalPresentationFormSheet;
[self.preLCtr.preCinescape_iPadViewController presentModalViewController:nvc animated:YES];
I am not sure about the size of PesentationSheet. I tried to take screenshots & take dimentions/size. But its not the exact solution.
Question : What is the exact size of Present-Modal-Sheet in iPad ?
This is what I found for the current (iPad 3) iO6 dimensions:
BOUNDS: 540.000000, 620.000000 - Portrait-no-keyboard.
But you shouldn't use this for any code. Follow the correct answer.
According to Apple's documentation the size could change depending on the available screen size:
The width and height of the presented view are smaller than those of the screen and the view is centered on the screen. If the device is in a landscape orientation and the keyboard is visible, the position of the view is adjusted upward so that the view remains visible. All uncovered areas are dimmed to prevent the user from interacting with them.
Maybe in the viewcontroller that is loaded to the FormSheet you can determine the view size at runtime by using: self.view.bounds;
If you need to resize the FormSheet i saw some answers on stackoverflow
If you're adjusting a freeform view controller so that you can get the aspect right for a modal transition with form sheet presentation style, note that there is a Form Sheet option under the Size dropdown in the Size Inspector. I didn't notice this at first.
I checked different orientation and also in multi window mode, the default size is
width: 540, height: 620.
And below is the screenshot from Reveal.
Related
I'm presenting a view controller with modalPresentationStyle set to formSheet, then I noticed the size of the view controller displayed isn't the same as how it's designed, it looks like iOS tries to shrink it to be smaller.
The doc says:
In a horizontally regular environment, the view controller is sized so that its content area is smaller than the screen size and a dimming view is placed underneath the content.
It's not clear to me how the resizing is done (ie. "the view controller is sized so that..."), I have a button with left/right edge margin, which isn't preserved. Is this how iOS works? Do I need to set preferredContentSize if I want to force it to have certain size?
Thanks!
My popover border was only partially showing the view I wanted to display, so I used the line self.buttonPopoverControllerH1.popoverContentSize = CGSizeMake(1000, 700); to enlarge it.
While it did enlarge the popover, the view still isn't central, and so it is still only partially displayed. Does anyone know how to rectify this?
I can't use autolayout as I'm developing an app for ios 5. I can't link in an image as I don't have enough rep, but
is what I'm talking about. Only half the view is displayed.
Set the rect when you present it..just modify to fit the frame you would like:
CGRect rect = CGRectMake(350,100,100,100);
[yourPopoverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Do you want the popover view to take up most of the screen? If so, you should consider using a Modal View, instead of a popover view. Popover views shouldn't really cover the entire screen.
How do I position this ViewController over the detail view modally? I want it to be right aligned so you can see the navigation portion greyed out.
[self.window addSubview:self.splitViewController.view];
MyModalViewController *modalvc= [MyModalViewController new]; //brevity
modalvc.modalInPopover = YES;
modalvc.modalPresentationStyle = UIModalPresentationStylePageSheet;
modalvc.view.autoresizeMask = UIViewAutoresizeFlexibleRightMargin;
[self.splitViewController presentModalView:modalvc animated:NO];
[self.window makeKeyAndVisible];
I also checked in MyModalViewController if im setting the views mask and I am not, nor is it getting magic values from a Nib.
Adjusting the frame before the present (using modalvc.view.frame) does nothing.
Adjusting the frame after the present seems to yield crazy results, and I only really need it to be half a width over in landscape... portrait is normal behavior.
edit
the picture confused people so I took it out, I dont want the modal view to be the size of the screen, I want to keep it UIModalPresentationStylePageSheet but have its ORIGIN moved right so that it covers the detail view portion in landscape
The modalPresentationStyle is what controls that. You've set it to UIModalPresentationStylePageSheet, which sets the height to the height of the screen, and the width to to the width of the screen in portrait orientation, exactly as in your screenshot.
I think the only way to get full width in landscape is to use UIModalPresentationFullScreen. See the UIViewController reference for more info.
I had a similar problem, and I ended up using a custom view controller that uses a background translucent view and a foreground opaque view that I am able to position anywhere I want by manipulating its frame. It's useful as a lightbox for videos and images.
I have a UISplitViewController that uses a navigation controller for its master (left) pane. When it rotates to portrait, this navigation controller is represented within a UIPopoverController. I'm noticing that the UITableView that is being shown in the navigation controller's current view does not resize when the app rotates to portrait. Namely, I see the popover at full height (about 1024 pixels), but the table is black along the bottom, seemingly still about 700 pixels in height.
How do I adjust the navigation and/or table view height properly?
This question is old, but for future reference, the documented way of handling this is to set the contentSizeForViewInPopover property on the view controller. You can also use the popoverContentSize property of the popover controller. See the dev docs for details.
In the below image, what is the UI control used to create the "Other Network" dialog? We need to create a similar non-full-screen popup.
I think what you're looking for is a UIModalPresentationFormSheet.
From Apple's UIViewController documentation reference
UIModalPresentationFormSheet
The width and height of the presented view are smaller than those of the screen and the view is centered on the screen. If the device is in a landscape orientation and the keyboard is visible, the position of the view is adjusted upward so that the view remains visible. All uncovered areas are dimmed to prevent the user from interacting with them.
Available in iOS 3.2 and later.
Declared in UIViewController.h.
See this article for an example Display a view using modalPresentationStyle
It should be a view controller presented modally using UIModalPresentationFormSheet as its modalPresentationStyle.