4
A
回答
7
提供的didRotateFromInterfaceOrientation
方法和中心的所有子視圖的實現。
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
for(UIView *subview in [self.view subviews]) {
subview.center = self.view.center;
}
}
0
您應該爲橫向和縱向模式更改programmatic-ally內容的框架。 你可以試試這個爲:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight){
// set contents' frame for landscape
}
else {
// set contents' frame for portrait
}
return YES;
}
相關問題
- 1. iOS - UIView的中心內容
- 2. 對齊UILabel以UIView爲中心
- 3. 容器UIView對齊到底部
- 4. UIView的AirPrint內容
- 5. 對齊中心css內容
- 6. 對齊UIView的子視圖
- 7. UIView中心,幀
- 8. UIView UITableViewController的中心
- 9. JavaFX:對齊FlowPane中的所有內容
- 10. 縮放UIView及其中的所有內容
- 11. UIView內的UIView沒有顯示
- 12. 對齊的UIView從屏幕中間
- 13. 滾動的UIView其內容
- 14. UIView的內容錯位
- 15. UIView中心X UIImageView
- 16. 從UIView中刪除所有對象
- 17. 強制對齊中心的內容
- 18. 中心對齊李的內容ul
- 19. JTable內容是中心對齊的
- 20. 將TableLayout的內容與中心對齊
- 21. 抓住UIView內容重繪
- 22. 如何剪切UIView內容?
- 23. 自動縮放UIView和旋轉的所有內容
- 24. UIView的旋轉中心
- 25. CGAffineTransform獲取UIView的中心
- 26. 內容沒有在一個UIView
- 27. 問題與中心對齊內容
- 28. 如何將內容與中心對齊
- 29. 獲取內容對齊中心
- 30. 將網站內容對齊到中心
你使用nib文件還是以編程方式添加它? – shannoga 2010-12-21 05:35:06
我爲此使用了nib文件。我知道這裏有對齊屬性,但通過設置這個我仍然面臨同樣的問題,在旋轉後。 – 2010-12-21 05:49:23