Monotouch.Dialog IOS 6 Split view Rotation issue

独自空忆成欢 提交于 2019-12-24 03:07:05

问题


BUMP .. still havent figured this out, the thing rotates, but out of view. so weird. can i provide better information to get help?

STILL HAVING THIS ISSUE! its really bad i cant fix this :( help PLEASE

BUMP .. please im dieing here! someone anyone! :)

So, I'm using Monotouch.Dialog and since IOS 6, the rotation of my splitview controller is acting weird.

It is actually rotating, but my detail view takes up the whole screen and the master view seems as if its being rotated off the screen frame. That is, I can see the master view for a split second when it rotates then it's gone, and the detail view takes the whole screen.

I've added the necessary ShouldAutorotate function and set the GetSupportedInterfaceOrientations since IOS 6. Like I said it rotates, but something is just off.

I've tried the IOS 5 simulator and it works, so it's definitely an IOS 6 problem.

Anyone have an idea where else I should look for the problem?

EDIT: I noticed while debugging that it doesnt go into the ShouldAutorotate override of my master and detail view, only in my split view controller it goes in. In iOS 5 it goes into ShouldAutorotateToInterfaceOrientation properly.

Here is the code i use in my Detail and Master views:

public override bool ShouldAutorotate()
    {
        return true;
    }
    [Obsolete]
    public override bool ShouldAutorotateToInterfaceOrientation       (MonoTouch.UIKit.UIInterfaceOrientation toInterfaceOrientation)
    {
        return true;
    }

And here is the code i have in my SplitViewController:

public override bool ShouldAutorotate()
    {
        return true;
    }

    [Obsolete]
    public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation requested)
    {
        return requested == UIInterfaceOrientation.LandscapeRight || requested == UIInterfaceOrientation.LandscapeLeft;
        //return requested == UIInterfaceOrientation.Portrait || requested == UIInterfaceOrientation.PortraitUpsideDown;

    }

    public override bool ShouldAutomaticallyForwardRotationMethods {
        get {
            return true;
        }
    }

anyone please? i need this for my work and i cant solve this! any ideas would be helpful!


回答1:


It's difficult to guess what's wrong without seeing the code itself. It's likely working on iOS 5.x because it will be calling the old shouldAutorotateToInterfaceOrientation: selector (and because your application and/or MonoTouch.Dialog already supports that).

This is deprecated in iOS6 - but it will still be called for backward compatibility unless you implement it's replacements. Note the plural form replacements, from Apple doc:

Override the supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation methods instead.)

The deprecation notices does not mean iOS6 won't work with the older API. It's a remainder that some new, better, API were added and that the old API could be removed in some future iOS release (removals have been so far very uncommon).

Note: I do encourage you to stop using old API from iOS versions you do not support (e.g. something deprecated in iOS 4.0 should be be used in applications supporting 5.0 and later only). However duplicating code to support both 5.0 and 6.0 best API might not be a good idea unless you gain something out of it (e.g. new functionalities).

Most of the new API, deprecating older API, are meant to make your life easier, not harder.




回答2:


Also don't forget to set window.rootViewController (otherwise rotation will not work on the iPad).



来源:https://stackoverflow.com/questions/12805250/monotouch-dialog-ios-6-split-view-rotation-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!