How can I get the resolution of the screen in Xamarin.iOS 8?
I tried UIScreen.MainScreen.Scale and UIScreen.MainScreen.Bounds.Height but I get 0.
Both of those are the properties you want to use to obtain this information.
This is very odd, because this works even from the "Main" method, even before FinishedLaunching is invoked.
Related
I have got a problem handling orientation changes from a nativeactivity for my opengl related app.
I have the JNI setup for two functions:
- One for setting the orientation and
- One for getting what the orientation currently is.
I am using the constants for setRequestedOrientation(int):
6 is SENSOR_LANDSCAPE,
7 is SENSOR_PORTRAIT,
4 is just SENSOR.
Now, im using config changes to handle it myself. And in this function I'm calling the java getorientation() function i setup. It is reporting correctly either landscape or portrait.
The problem comes in when i go to initialize my EGL display again. ANativeWindow_getWidth(window) is not reporting the correct width at all times. It'll work half the time. I think the engine->app->window is something being set from the parameter in android_main() and is used by egl to determine the screen dimensions.
But the value is wrong because i dont know how you go about updating the window with the correct one via config changes. anyone have any idea what i can do?
I'm testing my app on an iPod Touch running iOS 9 (on iOS 8.4 it was working for other functions: FaceTime, copy to contacts, etc.). I have a textview with phone number detection and I receive the following error:
Warning: Attempt to present <_UIRotatingAlertController: 0x16250e00> on whose view is not in the window hierarchy!
Assertion failure in -[UITextView startInteractionWithLinkAtPoint:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UITextView_LinkInteraction.m:377
Any fix to this?
Not a perfect solution but very simple and may help a desperate developer:
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange {
[[UIApplication sharedApplication] openURL:URL];
return NO;
}
You will lose the Copy, Open URL, Cancel popover on long press but you SHOULD at least be able to open url same as you would previously. In iOS 9, this still opens a browser window inside your app for standard URLs (which is nice).
This seems like an Apple bug (posted to radar already).
We were seeing very similar error when trying to open links in a modal view since Apple is trying to display a new modal alert view. Outside of modal view data detection worked just fine in iOS 9 for us.
This looks quite similar to a bug we recently had to fix for PSPDFKit where presenting sheets did not work when the rootViewController was already presenting another controller. (Is your rootViewController maybe not set?)
You can read the source code here. This might help you to figure out where the issue is for you:
https://gist.github.com/steipete/b00fc02aa9f1c66c11d0f996b1ba1265
And please dupe rdar://26295020 so this will get hopefully fixed in time for iOS 10. (The bug exists since iOS 8 and was first reported on iOS 8b5.)
I'm familiarizing myself with the Google Cast SDK by building a small test application, following the Cast SDK for Android guide. I've created a standard ActionBarActivity-based app as the guide suggests (even though ActionBarActivity is deprecated... shrug) I've added all the library dependencies, added the necessary XML to AndroidManifest.xml and menu_main.xml and am using the MediaRouteActionProvider to handle device detection and to show/hide the Cast button in the action bar. All is working well, and the "Connect to device" box appears as it should when I tap the Cast Button.
However, when I tap the Cast button again to disconnect, the "Stop Casting" box appears but it is unusually small.
The box is supposed to be wide enough to show the volume bar -- in my super-small version, the volume slider does in fact show up but it is unusably small. Compare to what it is supposed to look like, for example as in the YouTube app shown below.
Any idea what could be going on here? I am using basically the exact code that the Cast SDK for Android guide uses (the only addition being some custom Buttons with onClick listeners to control the media playback and to start casting several different test streams (both audio and video.)
This is due to changes that were made into the Media Router Support library and will be fixed in future updates to that library. If absolutely needed, the current workaround is to override that dialog.
I've created small library containing a custom window/stage to use for all my applications to have a constant and uniform look.
Basically it's just a undecorated stage with a AnchorPane which contains the customized Minimize/Maximize/Close and Resize controls.
The only problem is the method which is performed when the Minimize button is pressed. Nothing happens when running the app on my main system (Arch Linux), it looks like the application is frozen, here's a visual example:
Example image uploaded on Imgur, haven't got enough reps yet to post images
Minimize method code:
void minimizeWindow() {
window.setIconified(true);
}
On Windows 7 x64 everything works fine, the application gets iconified and also can be enlarged again.
I think this is a bug in JavaFX itself or a compatibility problem with GTK3.
Someone know how to fix this problem or got a workaround for this until this officially gets fixed?
Thanks in advance.
This is a known issue. This has already been fixed but there are few related left-overs jiras and this fix will be most-probably released with Java 9.
The release may be pushed forward, depending on the fix of the other related bugs.
You can view the details and follow up the same here :
[Linux] Stage.setIconified(true) not working with TRANSPARENT or UNDECORATED stage
I have a problem,
I am programming with Monotouch 5.2.8 for IOS 5.1.
But since the IOS 5.1 update my iPad configs the UISplitViewController so it is docked on the
left side instead of presented as a popover.
It works with IOS 5.0 but in 5.1 i got this problem.
Here is the source code for my UISplitViewController:
splitViewController = new UISplitViewController ();
splitViewController.WeakDelegate = detailViewController;
splitViewController.ViewControllers = new UIViewController[] {
navigationController,
detailViewController
};
From Apple's iOS 5.1 SDK release notes:
In 5.1 the UISplitViewController class adopts the sliding presentation
style when presenting the left view (previously only seen in Mail).
This style is used when presentation is initiated either by the
existing bar button item provided by the delegate methods or by a
swipe gesture within the right view. No additional API adoption is
required to obtain this behavior, and all existing API, including that
of the UIPopoverController instance provided by the delegate, will
continue to work as before. If the gesture cannot be supported in your
app, set the presentsWithGesture property of your split view
controller to NO to disable the gesture. However, disabling the
gesture is discouraged because its use preserves a consistent user
experience across all applications.
Here (login required).
UPDATE:
From what I understand on the above, we can kiss the automatic popover appearance of the master controller goodbye in iOS 5.1.
The only way I see is possible to keep the "old" appearance, is by implementing our own UIPopoverController and taking advantage of the ShouldHideViewController delegate method. Thankfully with MonoTouch, we have that method available as a property in the UISplitViewController class, making things a bit simpler.
I do get a strange behavior though. With iOS SDK 5.1 on my Mac and iOS 5.1 on my iPad; on the device, I get the "sliding" appearance, while on the simulator I get the "old", popover appearance. This is with MonoTouch 5.2.4, which is the latest stable version. Also, it does not contain a PresentsWithGesture property. I tried setting its value to false through MonoTouch.ObjCRuntime messaging, but no luck. The selector keeps returning true. So I cannot deactivate the swipe gesture.
Even tried creating my own UIPopoverController and assigning it as the master in the split controller to see what happens. Doesn't work because UIPopoverController is not a UIViewController...
Some useful info in this question, for ObjC.
Turns out you can disable the presentsWithGesture in the application delegate, but once the view controllers have been presented, there is no changing it.
I needed to disable the appearance of the left view controller during a login process, but turns out I can't enable it later.