Search code examples
iphoneios4uiviewcontroller

How to slide UIViewcontroller on a button even from bottom to top like an action sheet?


I am making an iPhone application. I want to slide a view controller on a button event from bottom to top just like action sheet. Can anyone please suggest me some code or sample for this? Please help.


Solution

  • Use the following code to slide a UIView from bottom to top:

     myViewController *obj = [[myViewController alloc] init];
     [self presentModalViewController:obj animated:YES];
    

    and the code below to slide a UIView from top to bottom, i.e., to dismiss the UIView:

    [self dismissModalViewControllerAnimated:YES];