我有一個視圖控制器在我的應用程序,總是要顯示在prtaint模式。此屏幕的對象將在運行時添加並基於protaint模式。這是我的第一個視圖控制器。強制viewcontroller是肖像單點觸摸iphone
我嘗試了一些規範,如:
但他們都不couldent幫助我。可以知道這個狀態的其他解決方案嗎?
我發現了一些事情有:
Monotouch - View created in landscape orientation is displayed in portrait orientation
,但我不知道如何使用這個。任何身體可以幫助嗎?
我用這個代碼
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
if (UserInterfaceIdiomIsPhone) {
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown );
} else {
return true;
}
}
public override bool ShouldAutorotate()
{
return true ;
}
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
{
return UIInterfaceOrientation.Portrait ;
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
return UIInterfaceOrientationMask.Portrait ;
}
但他們沒有工作。 。
autoroatate函數永遠不會調用:(
所以你在不同的視圖中有多個方向?在你的「支持的界面方向」中你有四個勾號?只有在運行時啓動的那個你總是想要肖像,這是一個正確的假設嗎? –
是的,視圖控制器是我的第一個視圖控制器在我的應用程序,我想成爲肖像,也在支持的接口方向我有四個三分之一 –