我正在開發應用程序的所有方向在Ipad ....但在開發過程中,我只做了風景模式..但是我想改變所有可能的方向...在這裏,我得到了一些問題.... 這裏是代碼...關於在iPad的UIOrientation問題
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
//return YES;
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || UIInterfaceOrientationPortrait);
}
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self adjustViewsForOrientation:toInterfaceOrientation];
}
- (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation {
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
\\Here I did my stuff..
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
{
\\Here I did my stuff..
}
}
的問題是,當模擬器啓動,如果伊茨在風景模式下,我得到的意見適當的大小,但如果模擬器處於potrait模式,我不能得到我想要的...如果我改變模擬器的方向,我會得到正確尺寸的視圖...
嘗試此方法 - (無效)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation持續時間:(NSTimeInterval)持續時間 –
事情是TAT我可以得到調整大小視圖文所述裝置改變取向(I thnk上述代表將被稱爲設備正在改變方向),bt我希望我的編譯器檢測設備的方向,而應用程序正在啓動並根據方向改變視圖的大小..我可以做這個嗎? – Icoder
您必須爲界面構建器中的所有視圖配置支柱和彈簧。 – MadhavanRP