UISplitViewController Common View - ipad

is it possible to have a common view for both master and detail view controllers.
What if I need to add a header image(at top, the very first view) common for both the master and detail view controllers. When the device is in the portrait mode the width of the header image view has to shrink to fit to the detail view controller's view and when the orientation changes to landscape the width of the same header image view has to be expanded that is the width of it has to be 1024. Please tell me whether doing this is possible. or any workaround for this?

I'm not sure about this, but you may need to explicitly set the image using a UIImageView in your DetailViewController and your RootViewController NIB. Then, during an Orientation change (Portrait -> Landscape), the UIImageView in the DetailViewController should automatically flip with the rest of the ViewController, giving you what you are looking for.

A splitViewController must be root view controller in your application. If you add splitViewController's view as a subview of some other viewController's view, splitViewController will not get the rotation events.
For your problem, change the design of your app so that the common view appears only in detailViewController part so that it will appear in portrait mode also.
If this is not feasible, the only option you are left with is to create your own splitViewController, so that you will be capable of adding it over some other views and send the rotation events to this splitViewController when rotation occurs.

Related

A vertical orientation app with one view controller horizontal orientation. How to design on the storyboard?

I'm currently working on a small iOS camera app and have a storyboard-related question.
(Sorry for my bad drawing) Here is what I got on my storyboard, I have two view controllers, mainVC and cameraVC, and I added table view cells to mainVC to add a segue to cameraVC. This app is a vertical orientation app, and I want to make this app horizontally only when the user gets to the cameraVC. I'm not planning to make this app rotatable, hence this app only supports the vertical orientation if the user is in MainVC and only supports the horizontal orientation if the user is in CameraVC.
I'd add several more vertical view controllers later on, so I make the app vertical on the storyboard. However, I was not sure how should I design the camera VC on my storyboard.
While the app is running and the user gets to the camera VC, I want the app orientation horizontal (and don't rotate to vertical) and display buttons on the right side, like the image below.
So my question is while all the view controllers set to vertical, should I place buttons on the cameraVC at the bottom like the first image, or is better to place buttons on the right side with assuming the VC rotates when the user gets the camera VC, like the image below?
Sorry for the confusing question.
When designing a view controller in storyboard there is no property for orientation. There are however simulated values that are applied to whole storyboard to be either landscape or portrait.
If you want to simulate these values differently I suggest that you move your camera view controller to another storyboard. I would actually do that regardless of the issue you are facing.
If this doesn't suit you for any reason then you can still simulate your view differently. You can simply select your camera view controller in storyboard and use a Freeform simulated size like on the screenshot below.

My app's main view doesn't resize to fill the screen when the device is rotated

Recently I ran into an issue with my app when changing the device's orientation.
This is my main ViewController (let's call it VC1) in portrait mode:
Now if you push / present any viewcontroller (let's call that VC2), rotate the screen while in VC2, and return back to the previous view (VC1), this is what I get:
Why doesn't VC1 rotate correctly like it should? This issue happens throughout the whole app and with any two views. I honestly have no idea what might be causing this or where to look, so any help would be appreciated.
Do you use constraints and autolayout? Can you post a screeen where constraints of the view are visible? I think there are some missing constraints
your navigation bar is properly resize in portrait and landscape mode So The main problem is you didn't add trailing Constraints to your view.
Just Add you trailing constraints on your view in Storyboard.

Rotating a VC presented as UIModalPresentationOverCurrentContext

iOS 8. I am presenting a view controller with presentation style: UIModalPresentationOverCurrentContext. This works great until I rotate my device, at which time the presented view is not properly adjusted.
Example: I presented over a portrait context. Entire screen covered by my new view (which has semi-transparencies). I rotate to landscape. The presented view rotates, but is now centered and remains at portrait width.
Both the presenting VC and the presented view are created in a storyboard using autolayout. Since I can't add constraints to the topmost view in a VC (right?) I'm not sure how to keep my presented view entirely covering the view below it.
This can happen if Presentation in the Segue is set to Page Sheet. In the storyboard, change the presentation to Full Screen or Over Full Screen
Since you're not using a segue, use UIModalPresentationOverFullScreen.

Parent UITableViewController not rendering when child rotates

The app I am building is having some issues when navigating in landscape mode.
This is how the table looks in portrait
but if I go to one of the child navigation items rotate and then navigate back in landscape it looks like this
I have tried everything I can think of and cannot fix it, I am using auto layout and storyboards
I'm guessing the table view isn't the main view of the view controller (i.e., self.view). Perhaps you dragged a table view from the object library onto the canvas for your view controller's storyboard scene. When you do that, the default implicit constraints created by Xcode will produce the situation you described upon rotation. You need to create your own explicit constraints in the storyboard that pin the four sides of the table view to its superview.

How do I resize a UINavigationController's contents when a UISplitViewController rotates to portrait

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.

Resources