我想我的UITableViewController只是橫向,但它甚至不會從肖像旋轉... 我在我的項目設置中將方向屬性設置爲橫向,並且我改變了StoryBoards中的UITableViewController方向,但仍然沒有。我還應該怎麼做? 在設備/模擬器上運行時,它被鎖定在肖像左側。爲什麼UITableViewController不能旋轉?
http://img15.imageshack.us/img15/9652/tavblef.png
我想我的UITableViewController只是橫向,但它甚至不會從肖像旋轉... 我在我的項目設置中將方向屬性設置爲橫向,並且我改變了StoryBoards中的UITableViewController方向,但仍然沒有。我還應該怎麼做? 在設備/模擬器上運行時,它被鎖定在肖像左側。爲什麼UITableViewController不能旋轉?
http://img15.imageshack.us/img15/9652/tavblef.png
嘗試添加這是您的viewcontroller.m文件
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation== UIInterfaceOrientationLandscapeRight|| interfaceOrientation== UIInterfaceOrientationLandscapeLeft);
}
部署目標5.0 + iPad 5.01 - >不起作用 – Dawid 2013-03-03 20:36:40
所以答案很簡單。 我在Storyboard中創建了一個新的項目和一個新的UITableViewController,但是我在默認的UIViewController類上工作,而不是創建UITableViewController的子類...
在您的視圖控制器中,應該有一個方法' - (BOOL) shouldAutoRotate',如果這是返回'NO'或'FALSE',那可能是問題。 – 2013-03-03 19:17:04
你用什麼ios版本? – edzio27 2013-03-03 19:21:06
@Mike D:這是新項目,並且shouldAutoRotate具有默認值 - YES – Dawid 2013-03-03 19:23:14