Orientation problem on (9930) blackberry - blackberry

I set orientation as portrait to my app.
When i check on os 6 and os 5 simulator, no problem.
But in os 7-(9930), my app display as landscape mode.
How do check and correct it.
Pls help me.

it's a Bold, meaning that its width is greater than its height which makes its portait view a landscape; anyway, you can force it to behave normal with:
net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections(net.rim.device.api.lcdui.control.DirectionControl.ORIENTATION_LANDSCAPE);

use the following code to make this for all devices
UiEngineInstance _ue = Ui.getUiEngineInstance();
if (Display.getWidth() == 640 && Display.getHeight() == 480)
_ue.setAcceptableDirections(Display.DIRECTION_LANDSCAPE);
else
_ue.setAcceptableDirections(Display.DIRECTION_PORTRAIT);

Related

Check the app orientation in iOS (not the device orientation)

Until now, I used to use this code to check if my device is in a portrait or landscape mode:
if (UIDeviceOrientationIsPortrait(UIDevice.current.orientation)){
//portrait
}else {
//landscape
}
But I discovered that this variable check the real position of the device in the 3D space. So if my iPad or iPhone is in a portrait mode and I put it on a table, parallel to the ground, the orientation will not be considered as portrait.
Is there a variable or something similar that can I check to know the orientation of the app and not the physical orientation?
Use UIApplication.shared.statusBarOrientation: The current orientation of the app's status bar.

Device orientation strange behavior

I have my Universal app ready and I set the device orientation to portrait only.
On the iPhone it's okay - only portrait, but on the iPads it is still can rotate to landscape. I double checked that I unticked the landscape left/right and left only portrait.
Actually it's not a big problem for me, because I use Auto Layout and it still looks okay when in landscape but maybe somebody can provide a reasonable explanation.
I use:
objective-c
XCode 6.1.1
testing devices iPhone 5c and iPad mini with Retina display
If somebody have a problem like I described above, just check the device orientations you need in ALL possible variants like iPhone/iPad/Universal.
Thanks #LyndseyScott

How to detect if ios8 custom keyboard extension is running in not iphone 6 optimized app?

In the app that not optimized for iphone 6 in standard display mode keyboard and status bar shows zoomed. This causes my manually layouted custom keyboard extension to show streched. How can I detect this zooming to fix layout?
Use self.view.frame.size.width It returns 320 for zoomed mode & 414 for regular mode on my 6+ (hopefully on 6 also) in - (void)updateViewConstraints
Eventually you will not need to do this as whatsapp and other apps get updated (I believe whatsapp just did) but how I get around it temporarily is by getting the size of the view where I am drawing my keyboard view.
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
The iPhone 6 and 6+ will tell you that your screen width 320 for portrait and 568 landscape like an iPhone 5. You can then use the same drawing you do for the iPhone 5.
When the app is optimized for the iPhone 6 and 6+ you will get their real measurements.
Something I don't get is why people are downvoting my answer when it is the right one. We had to specifically deal with this problem. When the app where your extension runs is not optimized for iPhone 6 the dimensions are the same as the previous iPhone and the app is scaled up to full screen. Just run in an iPhone 6 an old app that was never updated and see it for yourself.

Is this an iOS 8 Bug (orientation issue on rotation)?

since iOS 8 my App runs quite good, but I found a Problem while testing this app.
It just happens on iPad and only if I launch the app in landscape mode. If it launches in Portrait everything is right(no rotation issues). If i rotate the Device (simulator or real device) the view rotates out of the screen and just shows a Cut of the real view and the rest is black.
Anyone else did notice such a bug? How can I fix it?
Had similar problem. Surprisingly the fix was to comment out all the code related to self.window on Appdelegate.
Commented initialising of self.window and its assignment. Set the initial view in storyboard in Attributes inspector by checking "Is Initial View Controller" checkbox.
New Better Solution
Commenting self.window was causing other issues. Instead the below code is best:
- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification
{
[UIViewController attemptRotationToDeviceOrientation];
}
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
BOOL landscape = (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight);
NSLog(#"Currently landscape: %#, width: %.2f, height: %.2f",
(landscape ? #"Yes" : #"No"),
[[UIScreen mainScreen] bounds].size.width,
[[UIScreen mainScreen] bounds].size.height);
And the results are:
For iOS 8+
Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 568.00, height: 320.00
and for iOS 7-
Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 320.00, height: 568.00
It seems like there is a change in the way height and width of the screen is handled while in portrait and landscape from ios8 onwards.
Check this link
Is [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8?
UPDATE - We found a fix:
I found the answer to our problem which as described below appeared to be exactly the same as yours. One of our other developers noticed an "unexpected nil in main window" when attempting to tap on the far right of the screen. This led me to do a new search and I found this thread on stackoverflow that actually contained the answer to our problem.
( here is the link to the question which help my answer: unexpected nil window in _UIApplicationHandleEventFromQueueEvent )
The actual answer came from frankish who suggested opening the main.xib (or main storyboard) and clicking on the Window in that and making sure that the "Visible at Launch" and "Full screen at Launch" properties are checked (set to true.)
In our case, it was JUST the "Full screen at Launch" property that needed to be set, but setting this fixed the rotation problem we were seeing AND it fixed an issue where when launching on iPad in landscape the far right of the screen was not touchable.
END UPDATE - (original non-answer below)
My answer isn't an answer, but I have run into the exact same issue. On rotate in our app, when building with Xcode 6, I see the exact same rendering issue as the the screenshots on this question. The exact same out of position rotate with black bars at the side and bottom. (Our app on iPhone doesn't support any rotation so we don't see the issue on iPhone. On iPad we support landscape left and landscape right. When rotating from one to the other, when the iPad does it's standard rotation animation, it will rotate out of position (showing the black bars) when going one way and then rotate back into proper position when going back to the other supported orientation. I don't believe it's related to any custom positioning or animation code. It happens with every screen, including the splash screen. It appears to be related to the built in Apple screen rotation. Obviously not every project has this issue in iOS but I have not come across the particulars that are causing this issue. I spent all day yesterday researching the issue and going through our code and I have nothing.
One piece of additional info. If I build with Xcode 6 and run on a device with iOS 7 then there is not issue. This issue ONLY happens when I build with Xcode 6 and run on a device with iOS 8.
Here is a link to my own question posted yesterday about this issue. (I did not come across this question until after I'd posted my question.)
Building project with Xcode 6 (iOS 8 SDK) causes landscape rotation rendering issue on iPad
I found this to be an issue when I had multiple windows in my application. By setting a breakpoint on -[UIWindow setFrame:], I was able to see that upon rotation, the system was giving me giving me an erroneous frame size and position. You can get around this by manually setting your frame to equal [UIScreen mainScreen] bounds] which seems to be correct if you running on iOS7+ and compiling with Xcode6. I found that doing this in -[UIWindow becomeKeyWindow] worked well for me:
- (void)becomeKeyWindow {
[super becomeKeyWindow];
self.frame = [UIScreen mainScreen].bounds;
}

statusBarFrame.height returns 1024.0 when in Landscape (iPad)

I have been using the following code to get the height of the status bar:
[UIApplication sharedApplication].statusBarFrame.size.height
This works perfectly in Portrait mode and returns the expected value (20.0), but when the application is in Landscape, I get the unexpected value of 1024.0 !!
Is anybody able to shed any light on this for me?
iOS version 6.1.3
XCode version 4.6.2
Use this if you want to forget about orientation or coordinates related problems:
float statusBarHeight = MIN([UIApplication sharedApplication].statusBarFrame.size.height, [UIApplication sharedApplication].statusBarFrame.size.width);
You might need to use the [UIApplication sharedApplication].statusBarFrame.size.width on Landscape orientation. Same as [[UIScreen mainScreen] applicationFrame] gives switched values on Landscape orientation
This is completely correct. The statusBarFrame is in screen coordinates.
You have to use statusBarOrientation to check whether you should switch the coordinates.
At what point in the app do you get this?
If it's at first run, check what orientation your .xib files are in in the project. If they are in portrait then even though the app is started in landscape it hasn't had time to determine orientation and uses the dimensions of the .xib that it's creating the frontmost view controllers view from.
In iOS 6 the rotation handling and orientation detection changed
significantly from iOS 5 and lower, I beleive that you can no longer
rely on the orientation of the status bar for these values.
this may help
You don't need to check for the orientation, just use the UIView convenient method for converting the frame:
CGRect statusBarFrame = [self.view convertRect:[[UIApplication sharedApplication] statusBarFrame] fromView:self.view.window];
Clean Build your code and check whether orientationChange methods are called.
Please specify the iOS version as well

Resources