2014-03-27 40 views
0

用於將LandScape的視圖旋轉爲縱向及其對應的控件,如按鈕和標籤等。 實際上將旋轉到界面方向方法未在iOS7中調用。 我使用這樣的視圖旋轉,如何在iOS7中設置視圖及其控件框架?

-(BOOL)shouldAutorotate 
{ 
    return [[self.viewControllers lastObject] shouldAutorotate]; 
} 

我需要在這裏設定的框架。我怎樣才能做到這一點?請幫忙。謝謝!

+0

並且此方法適用於所有視圖。 – Laxmi

+0

嗨,你可以''willRotateToInterfaceOrientation'將在iOS7中工作。我只是試了一下。嘗試用斷點測試。 – GoGreen

+0

我認爲你的視圖控制器不支持這個方向.i.e這個方法沒有被調用。覈實。 –

回答

0

要爲您的視圖設置框架,您應該訪問視圖的框架屬性並將其替換爲新框架。例如:

CGRect newFrame = CGRectMake(newX, newY, newWidth, newHeight); 
yourView.frame = newFrame; 

newXnewYnewWidthnewHeightCGFloat型。
您可能會對控件執行相同操作。例如:

yourLabel.frame = newFrame; 

希望這有助於!

相關問題