0

I have an UIViewController with TableView which is showed when I pressed Button in another View. It slides correctly from the bottom of the screen, but I want its height to be half of screen height and stays at the bottom of the screen.

How can I get this?

Here is my code:

CupsViewController

This is the code when Button is pressed for showing TableView.

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

1 Answer 1

1

Set the options frame height to half of screen size in your animation code.

Hope this is what you are looking for

https://github.com/slysid/iOS/tree/master/HalfTable

/Bharath

Sign up to request clarification or add additional context in comments.

5 Comments

I want it to stay at the bottom of the screen, too.
Can you check the project from GITHUB and see is that something like that you are trying to do?
I can't find how to import your project into XCode. Do I have to copy all files by hand?
I have added a tableviewcontroller and it works fine. github.com/slysid/iOS/tree/master/HalfTable
github.com/slysid/iOS go to this location and you can see download option in bottom right hand corner. You can download the project and open it in Xcode

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.