May 21, 2021 CrossApp
1. CrossApp offers us solutions:
2. Dip type data provided by CrossApp
When we develop mobile applications, we will first face a very difficult problem, that is, the market for mobile phones, tablets and other devices have different screen sizes, resolutions, screen width ratio is also diverse, how to solve this problem?
To solve this problem, we need to understand some of the basic concepts about display that are already on the market for our common dimensions and resolutions.
Common resolutions
1136*640,1920*1080,960*640,1280*720,800*480。
Common screen size
3.5 inches, 4 inches, 5 inches, 5.5 inches, 7 inches, and so on.
PX: pixels, absolute pixels.
The size is fixed and does not change with the screen
PPI: Pixels Per Inch represents the number of pixels per inch. T
herefore, the higher the PPI value, the higher the display's ability to display the image at a higher density.
Of course, the higher the density displayed, the higher the trueness.
DPI: Points per inch, usually on Android devices, represent the fineness of the display of the device's screen in DPI.
Typically, PPI and DPI can represent the same concept, with PPI primarily for display devices, and DPI is more commonly used on printout devices, but both represent the pixels contained per inch
Open the file in the RootViewController.mm directory
// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//竖屏
//return UIInterfaceOrientationIsPortrait( interfaceOrientation );
//横屏
//return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
//竖屏
//return UIInterfaceOrientationMaskPortrait;
//横屏
//return UIInterfaceOrientationMaskLandscapeRight;
#endif
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
//竖屏
//return UIInterfaceOrientationPortrait;
//横屏
//return UIInterfaceOrientationLandscapeRight;
Changing the Device Orientation property to Landscape Right is pictured:
Android Manifest .xml the android:screenOrientation property in the app.
"unspecified": The default is determined by the system. T he decision strategy is device - related, so different devices will have different display directions.
"landscape": horizontal display (longer than height)
Portrait: Vertical display (height ratio is longer than width)
"user": The user's current preferred direction
"Behind": in the same direction as the One city below the Actity (in the Actity stack)
"sensor": There are physical sensors to decide. I f the user rotates the device, the screen switches across the vertical screen.
"nosensor": Ignores the physical sensor so that it does not change as the user rotates the device (except for the "unsifiedpec" setting).