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);
}
在项目属性中也有这样做的方法。。可以在“项目设置”窗口中设置方向
希望这能解决问题..: