Rotating IPad Screen Orientation on Different Views - xamarin.ios

I have an iPad application that opens up in portrait mode but when I switch to another view I need to force the orientation to landscape so that the user realises they need to physically move the screen orientation to landscape, and then when they leave this view I need to force the orientation back to portrait.
I can see the ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) which if believe correctly just restricts the orientations that are possible for the view but setting this to one orientation (e.g. UIInterfaceOrientation.LandscapeRight) doesn't force the orientation to change.
I've seen some other suggestions about forcing the View to rotate using this.View.Transform.Rotate(...) but doesn't seem to work for me.
Just wondering if anyone had any suggestions or be able to point me in the right direction?
Thanks

Are your views all displayed within a single uinavigationcontroller?
If they are, then I'm afraid that the answer is that you cannot achieve what you are looking to - see a full explanation, including links to the Apple developer docs on: How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?
If you do want to achieve the effect you are looking for the, then maybe switch to using some other "parent" for all your child views - e.g. displaying them modally?

First, set ShouldAutorotateToInterfaceOrientation to support landscape orientation only.
Then use this hack to force orientation change:
var c = new UIViewController ();
PresentModalViewController (c, false);
DismissModalViewControllerAnimated (false);

Related

Blender : Some objects disappear when I turn to camera mode (it's not the snapping I think)

OK... here is the thing...
I am modeling a Star Wars Cruiser.. I'm doing pretty fine, but.. whenever I look through the camera, half of my ship disappears ?! Now you might think it's the clipping, but that doesn't make sense, since the clipping is set to 0,1 mtr - 10.000 mtr, which should be more than enough. Besides that, the clipping is the same for both the visible and now disappeared objects...
Does anyone have any clue ?
I also tried to change the Local view to Global view.. but no dice...
Here is a screenshot in not-camera view :
And here is one in camera view : i.imgur.com/XaxAHIN.png
I'm using Blender 2.82
Please let me know if you need more info or even a link to the model...
OK, I got some help from a friend... Joshua Rooijakkers from the Netherlands...
He fixed the problem in seconds...
So ... it WAS the clipping.. the setting was just buried somewhere I didn't look...
Thanks Josh ! :-)
Objects disappear in camera view modeWhile setting up my camera with the camera lock to view option selected, I noticed that on switching on to the camera view, the object had disappeared.
I tried zooming in and out, but that did not work. I exited the camera view and then selected the object in the outliner and then tried zooming in and out and then panning down and adjusting the view in the view port. I could see that the object was now visible and that the camera was positioned below the object. That was because the camera was added wrt to the position of the cursor which was snapped to the world origin. I a sure many would have encountered such issues.
I then selected the camera to ascertain its position. Then by using the grab tool, I moved the camera along the Z axis just above the object and then switched to the camera view and selected the lock camera to
view option to adjust the camera view to the desired position.
This helped me locate my object in the camera view. Do let me know in the comments if there are other ways of dealing with this.

iPhone SDK UIImagePicker Hide Controls

I know how to hide the camera controls (.showsCameraControls = NO) but if I do this I will lose the button to switch from rear to front facing camera which I need, is there a way to keep that but lose the controls at the bottom?
I tried keeping all of the controls and overlaying on top of the bottom bar but the bottom bar is always on top of the cameraOverlayView whatever I try. I think it used to work but doesn't in 5.0.
I also realise you can add your own button to switch between the 2 cameras (.cameraDevice) but I want to keep it looking as much like the proper interface as possible.
Any pointers are really appreciated, The whole point of this is that I need to call .takePicture myself but want the interface to look exactly like it normally does with all of the default buttons.

Magnifier like feature inside popup window....how to?

I need to create a magnifier like feature in my app. Like the "loupe" effect on the iphone !
The problem is that I need to do that inside a popup window and I don't get how to make it work !
The popup window display a grid of colors that I generate and draw one by one using shapeDrawables. What I want is to display that color bigger, zoom on it when the user touch and move his finger around the popup window (color grid). The idea is to create a tracking-zooming effect on the colors so the user can see more clearly under wich color his finger is currently located.
Problems are :
I can't seem to create another popup window on top of this one, Android limitation I think ?
If I modify the current shapeDrawable, resize it, change the boundaries, It needs to re-display the popup window before it takes effect (which is not acceptable of course)
So, anyone knows of a way I could draw over that popup window ?
EDIT :
I've tried solving this issue using a Custom Toast object...But it doesn't quite do the trick. It works, but toast object appears slowly and so the touch motion is not in sync at all with the user movement over the color grid.
I'm not sure if this will help you or not, but you might be able to accomplish this by using a second Activity... this second Activity would use Android's translucent theme if you include the following attribute in your manifest:
<activity android:theme="#android:style/Theme.Translucent">
This second activity will now only contain what you place in your layout. That is... the "real" activity you're running will still be visible behind it (anywhere you don't cover it up with views in the new layout).
You also might prefer Theme.Dialog if you really want to resemble a popup.
Something to keep in mind if you take this approach is you will probably want to override onWindowFocusChanged() in the new activity, and finish() in the event of you losing focus. Additionally, you'll need to figure out how to share your data between the two activities.

UIImagePickerController: Custom camera overlay sitting on top of default controls?

I'm creating a custom camera UI using UIImagePickerController cameraOverlayView property. However, I'd like to keep some of the existing UI -- specifically the flash and camera selection buttons at the top.
My thought was that I'd keep showsCameraControls = YES set the cameraOverlayView to my custom UI and then use [picker.view bringSubviewToFront:overlayView] to make sure my controls on the bottom are sitting on top of the default controls.
Alas, this does not work. I've tried moving the overlay to the front of the view hierarchy in various places without luck. Is there any UIImagePickerController hackery that could achive this? It seems a shame not to be able to reuse at least some of the camera controls while still customizing the UI.
Further investigation it appears this is not possible. You either have to use all of the default cameara UI or none of it.

Annotation in UIWebview in iphone sdk

I need help for, scribbling on the webpage i.e where ever the user moves on the uiwebview there it should draw a line according to the touch moves.
Is this possible.
Can any one please help me in this.
Thanks,
Mrudula.
yes it is possible just you have to write uiWebView.scrollView instead of uiWebView for getting coordinates of uiwebview.
I started working on something sort of like this. It doesn't currently let you "draw", but it does let you detect and record relative touch coordinates so that you can scale them correctly when zooming in. The DSAnnotationView object lets you provide a custom UIView to be toggled at the annotation point. Check it out here: https://github.com/justindarc/WebViewAnnotations
-Justin

Resources