How to make a List in Landscape Portrait - list

On click of a Button
I have created a List that comes out on the next Screen
Now i want to set it as Landscape Portrait
If the Height in Resolution is greater than its Width how do I achieve it?

With Blackberry, you cannot set the device orientation to landscape/portrait, unless the user holds in that way and then you set it in the app.
You can set the device to landscape using the following code.
Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_LANDSCAPE);
Remember, this code wont work if you are holding the device in portrait mode. Turn the device into landscape mode and then run this code and the app is set to landscape mode from then on.

Related

How do you create a Splash Screen per iOS device resolution and color scheme in Expo?

I only saw two options in app.json
tablet and non-tablet.
I was wondering if there's a way to put in specific resolutions for the splash screens? This is to attempt to conform to Launch Screens in their HIG which makes more sense as it continues to smooth down the path from launch to app (and not be a artistic/marketing slide)

Qt5.4/QML: How to determine wether the orientation of the screen is inverted or not

I'm creating a iOS video camera app using Qt5.4.
For this I need to determine the current orientation of the device to rotate the video in the VideoOutput element.
As we can see there's a autoOrientation property but it doesn't work as I expect: if I keep switching the orientation it starts to have a weird behaviour i.e. setting the wrong orientation.
Then I tried to apply the rotation based on the Screen.primaryOrientation property:
Copying the function defined in this example, I've a created a similar version, which you can find here.
I call it every time width or height changes, like this:
onWidthChanged: { video.orientation = changeOrientation(); }
onHeightChanged: { video.orientation = changeOrientation(); }
However, it seems that the Inverted orientations are completely ignored, which is strange since they are listed in the documentation.
Anyone has any idea about why it's happening?
UPDATE:
I could isolate the problem when using autoOrientation, basically there's a menu on top of the VideoOutput, the menu is a RowLayout, it's visible only if the user clicks on the menu icon, and only if the user clicks on the menu icon the orientation gets messy.
However, in any situation the InvertedPortrait is not recognized.

Creating Launch Screen.xib for iOS8 ( ... iOS11, Swift 4 and LaunchScreen.storyboard )

I've just found out that in order to be able to have the description for your app in the app store say "This app is optimized for iPhone 6, and iPhone 6 Plus." you need to use a launch XIB or storyboard file for your launch images (per [Apple][1]).
So, I've created a new Launch Screen xib and now I'm a little but since I usually do everything in code and don't use interface builder. I've deleted the default label that is inserted and dropped a UIImageView into the view. Now I'm wondering how would I:
1) Tell the UIImageView to resize to the size of whatever screen it's on
2) Tell the UIImageView to pick ImageA if a 3.5 inch screen is running the app or the ImageB if a 4 inch screen is running the app etc. etc.
Essentially, I'm just trying to get the launch .xib to mimic the behavior of how the launch screen works normally. Would appreciate it if anyone could provide some assistance on this!
You have two options:
You make use of autolayout and give the imageview a fullscreen appearance (distance to top, bottom, left and right equals 0). This would however result in a clipping of the image for certain screen sizes, what you may not want. So you might want to consider (2)
You place the launch screen image into an asset catalog and just put different images into the different size classes.
I found the answer useful.
The old steps in short for creating the LaunchScreen xib for iOS 8 are below the new steps.
With reference to XCode 9, Swift 3 or Swift 4 and LaunchScreen.storyboard following are the new steps.
First step is to create two images for Portrait and landscape mode splash ( png or jpeg ) in your favorite graphic software. ( If your app only support Portrait mode, you may skip Landscape mode image and settings. )
Portrait mode image :-
Create a 'splash-portrait' image with your own full background for size of "width 1125 x height 2436". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 1125 x height 1471". This should always be in center of above full image.
Landscape mode image :-
Create a 'splash-landscape' image with your own full background for size of "width 2436 x height 1125". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 860 x height 1125". This should always be in center of above full image.
Once both the images are ready, you may add it to xcassets or keep in resource.
Now go for the following steps.
1) "LaunchScreen storyboard" is already created with the new project. Open it.
2) Add an Image View on the view.
3) Set the above saved 'splash-portrait' image to image view source.
4) Set Image view 'Content mode' of Image as "Aspect Fill".
5) Add 4 constraints of Image View for Top, Bottom, Trailing and Leading to Superview.
This is done for the portrait mode app splash.
For landscape mode support, do the following extra steps. ( you may refer full answer by #Sakiboy at
https://stackoverflow.com/a/46089856/2641380 )
6) Click the + button next to the Image view source that you set up in step 3.
7) From the pop-up that is now displayed select Regular for both the Width and Height selectors. This is specifying a new adaptive set for iPads that are in landscape. A new image source field will appear with the title wR hR. Add the 'splash-landscape' image to the wR hR Image source field so the storyboard knows to use a different image when in landscape.
8) Now we need to add support for the 'iphone plus' devices when in landscape. So click the + button next to the Image source field again.
9) This time select compact for the height and regular for the width selectors. This is specifying a new adaptive set for “iPhone plus” devices that are in landscape. A new image source field will appear with the title wR hC.
10) Add the “splash-landscape” image to the wR hC Image source field so the storyboard knows to use a different image when in landscape on an “iPhone plus device”.
As iPad devices are "Regular for both the Width and Height", We will see 'splash-landscape' image in iPad for both portrait and landscape mode. Width 860 for displayable content in 'splash-landscape' image will show full content in both portrait and landscape mode.
The old steps in short for creating the LaunchScreen xib for iOS 8.
1) create a new "LaunchScreen xib" from new file --> user interface --> launch screen ( keep auto layout ON ).
2) Add an image view in the xib --> view (main view).
3) set splash image to it ( the image should not be in assets file ).
4) set image as "Aspect Fit" ( if required ).
5) you may also change the "view" (super view) background color as close to background color of image.
6) select the image view, click from menu - editor - pin - bottom space to super view.
7) this will show red error mark near "view" ( super view of image view ).
8) click on the error mark, you will see approximate two auto layout errors.
9) on clicking on the error you will find menu with auto fix the layout errors.
10) on fixing the errors, you will find total four "Constraints" with "vertical" and "horizontal" space between superview and image.
11) now you may test them in different devices or simulators.
Regards.
You can resize the image by setting constraint to the top, bottom, leading and trailing edges of the superview. Just click the imageview and select Editor->Pin the top context menu. You can also set the aspects of the UIImageView by clicking it and setting it to for instance "Aspect Fit". Make sure the ImageView covers the whole screen before setting the constraints, or else you would have to modify the contstraints.
To set different images for different screen sizes, I would guess you have to create a class and modify to the viewWillAppear method to load an appropriate image
Good luck!
Erik
Create a new file. Under User Interface select View. After, you can name your xib LaunchScreen and you can test it out by adding a label with something like “Test Launch” and run the app. You should see the launch screen appear!
The Launch xib can't have a customized class since your app didn't launch when it is displayed.
What I ended up doing is:
use sizing class feature
Create 3 UI images (one per sizing class)
Use auto layout with constrains which apply to each sizing class
So when you display one type of device the width and hight constrains of the other two UIImageView are set to 0

Cocos2d-x SetFrameSize make screen touch event wrong position

I use visual studio to implement my Win32 game project, but because I will port it to android platform later, so in AppDelegate class, I use setFrameSize to make window screen be like a mobile screen as below:
glview->setFrameSize(600, 900);
glview->setDesignResolutionSize(320, 480, ResolutionPolicy::FIXED_WIDTH);
But I got problem when implementing menu items, if I use setFrameSize function, when I touch to menu item, they does not work because their visual position is diffent from thier real position. If I comment out the set frame size command, menu items work correctly, but my screen too big and is very difficult for me to develope mobile game. Does anyone know why this problem come to me and how to resolve it? Thank alot.
Edit: I use visibleSize to set position for my menu items. It seem to not the same as what I want because when I set position of sprite is 3/8 of screen height ( bottom up), it become 1/2 of screen height ( bottom up).

cocos2dX Orientation Support

I am having this problem when doing a simple orientation test.
Suppose I am using a design resolution of 480*320 for landscape and 320*480 for portrait mode.
Now I have a long sprite of width 480 which doesn't show all of itself in portrait mode.
Then upon orientation change, I reposition it so that it should show properly.
After doing so, I successfully place the sprite correctly, anchoring at the bottom left corner, but the sprite still doesn't fully show itself.
http://tinypic.com/r/34e45c2/8 <- portrait mode
http://tinypic.com/r/2s84vgh/8 <- landscape after repositioning
Steps to reproduce:
1) create a default project with the create_project tool
2) Edit RootViewController.mm as follow
add these 3 lines to didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
auto dum = Director::getInstance()->getRunningScene()->getChildByTag(13579)
->getChildByTag(24680);
dum->setPosition(cocos2d::Point::ZERO);
dum->setAnchorPoint(cocos2d::Point::ZERO);
}
3) add the tags used above,
under createScene change to
scene->addChild(layer, 0, 13579);
under HelloWorld::init
this->addChild(sprite, 0, 24680);
4) under project setting "General" tab, tick all 4 modes under "Device Orientation"
5) run in simulator and then click Hardware->rotateLeft
How may I fix this problem?
[I have tried changing the HelloWorld layer's content size to getFrameSize() as well with no luck.]
Thanks.
PS I am using cocos2dx-3.0alpha1
You can try adding the following code in your AppDelegate.cpp in your AppDelegate::applicationDidFinishLaunching() methode :
glview->setDesignResolutionSize(320,480,ResolutionPolicy::SHOW_ALL);
Worked for me. I hope it helps.