我需要将状态栏顶部的表格视图设置为横向模式中心,但是表格视图会自动转到水平,即从右到左。我究竟做错了什么?这是我的代码
- (IBAction)pressToGetTableview:(id)sender
{
tableViewhavingOptions.frame =self.view.frame;
tableViewhavingOptions.center = CGPointMake(self.view.center.x -
CGRectGetWidth(self.view.frame), self.view.center.y );
[self.view.superview addSubview: tableViewhavingOptions];
[UIView beginAnimations: nil context: NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(pushAnimationDidStop:finished:context:)];
tableViewhavingOptions.center = self.view.center;
self.view.center = CGPointMake(self.view.center.x + CGRectGetWidth(self.view.frame), self.view.center.y );
[UIView commitAnimations];
}
答案 0 :(得分:0)
检查以查看viewcontroller的方向
这可以通过使用
来完成- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations.. use specified orientations that you want to see in the view
return (interfaceOrientation != UIInterfaceOrientationLandscapeLeft || interfaceOrientation != UIInterfaceOrientationLandscapeRight);
}
并且还有一种方法可以在项目属性中执行此操作..您可以在项目设置窗口中设置方向
希望这能解决问题.. :)