IPad orientation support like home screen application icons - ios

How to make a view with 3x4 thumb ImageViews in portrait mode and 4x3 thumb ImageViews in landscape orientation exactly that looks like
The orientation effect in iPad home screen icons change/animation effect from landscape to portrait vice verse..I have gone through the app (https://github.com/jarada/myLauncher) but it has the effect that it looks like going to set the frames every time device rotates.
Guide me how to design it a sample tutorial link

You can use UICollectionViewController, adjust its layout to return the desired sizes & locations for your icons.
This tutorial can help you create a custom UICollectioViewLayout.
Hope it helps.

Related

Scrolling in app when the Ipad is landscape and the app no longer fits in the size of the screen

Hello stackoverflow community,
I have just added the constraints to my iPad app and would now like that if you hold the iPad across that you can scroll the page, because not everything fits on a transverse page. If the Ipad is upright you should not be able to scroll (there everything fits).
How can I make that happen?
Edit:
I would like to be able to use landscape mode on my app, which I originally designed to be portrait only. For this I have already inserted all constraints so that the size etc. fits. Now, however, the page is so full that it no longer fits on the complete display in landscape mode. Now I would like to be able to scroll down and thus the complete page is on the display. How it looks at the moment in portrait and landscape format I have loaded into the attachment (do not wonder the app is in German).
Landscape
Portrait
add your views into UIScrollView and set its contentsize, you can thencontrol what should be visible or scrollable for both portrait and landscape

Lauchscreen.storyboard landscape splashscreen

I am using lauchscreen.storyboard for splashscreen in my iOS application. I have added splashscreen image in the storyboard. When app is lauchning, portrait splashscreen is coming correctly. But, when opening app in landscape mode, blue color appears in both right and left side of the splashscreen.
I tried setting different splashscreen image by adding variation. But, this storyboard takes any one portrait or landscape image only.
Let me know how to set two images in storyboard, one for portrait and one for landscape or the best practice to set splashscreen for both portrait and landscape orientation. I couldn't find any solution for this in the web though it seems to be a simple problem.
Setting the same launch image for both orientations:
Add an image to your LaunchScreen.storyboard's main controller's view and constraint all edges to superview (not safe Area)
Note: to change a constraint that is referencing SafeArea you can double click it on the inspector and change the respective item. Here are some screenshots for reference
Set the image's content mode to something that scales appropriately (scale to fill or aspect fill for example)
The setup should look like this (you can enable the previews on the right by clicking the assistance editor and switch from Automatic to Preview):
Setting different launch image depending on orientation:
Click on the + button next to your image
Add a customization for regular width & compact height
Your setup should look like this:
Update: What about the iPad?
Unfortunately, it seems that (at least up to Xcode10.1) is not possible to customize your launchscreen the same way for iPad, for a couple of reasons. The main one is that iPads are Regular x Regular for both portrait & landscape. The other reason is that you cannot use custom classes in your LaunchScreen.storyboard. Because if you could, you could subclass UIImageView and override the traitCollection with something like this (essentially would be treating the iPad as an iPhone sizeclass-wise):
override public var traitCollection: UITraitCollection {
if UIDevice.current.userInterfaceIdiom == .pad && UIDevice.current.orientation.isPortrait {
return UITraitCollection(traitsFrom:[UITraitCollection(horizontalSizeClass: .compact), UITraitCollection(verticalSizeClass: .regular)])
}
return super.traitCollection
}
By the way, you can still use code like the above in the rest of the application for your windows/views if you want to solve similar problems.
I know that this is not what you were looking for in the answer, but I am afraid that (for now), you'll have to use static images in your Assets for handling iPad.
By default use portrait, Add variation to your image for landscape version with these selections.
Update your landscape picture here.
personally, I also recommend you to use AutoLayouts.
Run the app.
Example - Results -
how to set two images in storyboard?
iOS has sizeClass for almost anything you can see. You can choose image, color, etc for any situation you need based on size of the main window of your application (Not only orientation of the device)
It's more convenient. Because maybe the device is in landscape mode but it's in split screen of iPad 🤷🏻‍♂️. So let OS decides what is best match for the size situation.
- Size Classes in interface builder
[
- Working example:
Make use of Vary for traits as shown ion screenshots. I have tried this and has worked for me.

How to make launchscreen.storyboard support portrait and landscape

I use LaunchScreen.storyboard as my launch image. It works ok when the devices are portrait. When i launch the app on landscape mode on ipad or iphone7 plus whe image was stretched.How can i use two different image for portrait and landscape mode.
Thank you.
You can set another image based on the size class traits. Unfortunately this does not help with left and right landscape rotation (you can only have an image for one of them). Also it is kind of base on the fact that for current iPhones landscape can be detected by having a compact height trait. This may change in future.

Make some views independent to orientation change

How Can I make some of my UIViews to be orientation independent and some of them dependent. I'm looking for effect similar to this in standard iOS 9 Camera App when user change orientation from Portrait to Landscape. In Camera View Controller only left Icons and Right Icons are rotating but the internal view stays on position independently.

Manage orientation landscape and portrait both in a app iPhone

According to my client's requirement I want to set Splash Screen orientation in landscape(right) then the orientation will come in portrait.. any idea how can I implement it?
Just rotate your splash image in an external editor so that is gets displayed in a landscape mode.
Just because you perceive it as landscape doesn't mean it's actually not "rotated portrait".
See your Splash Image will look like this:
Just rotate your image the way you want it to look like...
The iPhone only has a single splash screen, no matter which orientation it launches in. The iPad on the other hand will display a different splash screen image in portrait and in landscape mode.
If your iPhone interface supports both portrait and landscape then you must decide which way round you'd like to display that splash screen image. As Kanan says, design your landscape image (say in Photoshop), then rotate the canvas so that the image is portrait (but the content is still landscape).

Resources