gbaor
gbaor

Reputation: 1427

Slide up UIView

Hi i want to slide up by button click an anothet UIView over the original, and after user click on a back button a want to come back to original UIView. Like notofikations view in facebook app, or showing the photo library from camera app.

How can I realize this?

Upvotes: 0

Views: 963

Answers (2)

Vagrant
Vagrant

Reputation: 1716

This is what you use view controllers for. The standard view controllers have built in methods to do this transition. If you want to do it manually, you can tell your current view controller to invoke a new view controller via the presentModalViewController:animated: method.

If you don't want to use view controllers, you can just position a new view below the bottom of the current view and then use Core Animation to move it into position. The easiest way would be something like this:

[[view animator] setFrame:position];

But the proper way to do it is with a view controller.

Upvotes: 0

sosborn
sosborn

Reputation: 14694

The method you are looking for is found in UIViewController. In your view controller just do something like this:

[self presentModalViewController:viewControllerOfViewToSlideUp animated:YES];

Upvotes: 1

Related Questions