2013-08-05 92 views
0

我有一个UIViewControllerTableView这是显示当我按Button在另一个View。它从屏幕底部正确滑动,但我希望它的高度为屏幕高度的一半,并停留在屏幕的底部。更改高度的UIView

我怎样才能得到这个?

这里是我的代码:

CupsViewController

这是代码当按下用于显示TableViewButton

//DirectionViewController is the one that contains TableView 
DirectionViewController *directionController = [self.storyboard instantiateViewControllerWithIdentifier:@"directionsView"];   

// Position the options at bottom of screen 
CGRect optionsFrame = directionController.view.frame; 
optionsFrame.origin.x = 0; 
optionsFrame.size.width = 320; 
optionsFrame.origin.y = 423; 

// For the animation, move the view up by its own height. 
optionsFrame.origin.y += optionsFrame.size.height; 

directionController.view.frame = optionsFrame; 

[UIView beginAnimations:nil context:nil]; 

optionsFrame.origin.y -= optionsFrame.size.height; 
directionController.view.frame = optionsFrame; 

[UIView commitAnimations]; 

[self.navigationController pushViewController:directionController animated:YES]; 

回答