Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 将表格视图设置为水平_Iphone_Ios_Animation_Ios5 - Fatal编程技术网

Iphone 将表格视图设置为水平

Iphone 将表格视图设置为水平,iphone,ios,animation,ios5,Iphone,Ios,Animation,Ios5,我需要在横向模式下从状态栏顶部到中心设置表格视图的动画,但表格视图会自动转到水平方向,即从右向左开始。我做错了什么?这是我的密码 - (IBAction)pressToGetTableview:(id)sender { tableViewhavingOptions.frame =self.view.frame; tableViewhavingOptions.center = CGPointMake(self.view.center.x - CGRectGetWidth(self.view.

我需要在横向模式下从状态栏顶部到中心设置表格视图的动画,但表格视图会自动转到水平方向,即从右向左开始。我做错了什么?这是我的密码

- (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];

} 

检查以查看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);
}
在项目属性中也有这样做的方法。。可以在“项目设置”窗口中设置方向

希望这能解决问题..: