I am doing a partial page curl in this way:
- (IBAction)settings:(id)sender {
Settings *go = [[[Settings alloc] initWithNibName:#"Settings" bundle:nil] autorelease];
go.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:go animated:YES];
}
How do I uncurl this animation?
-(IBAction)backClicked{
[self dismissModalViewControllerAnimated:YES];
}
Just dismiss the modal view controller as you always do. iOS will take care of the transition as you have already specified the modalTransitionStyle.
[self dismissModalViewControllerAnimated:YES];
Also you can try to tap on left top corner with part of curl page to automatically dismiss view controller.
Information for > ios 6.0:
dismissModalViewControllerAnimated is deprecated now.
The new method it´s without "modal", looks like that:
[self dismissViewControllerAnimated:YES completion:nil];
Related
In my application, i tried to use the function
[self.navigationCotroller presentModalViewController:nextVC animated:YES];
However, when it goes to the next view, the subview fulfill the whole screen(of course it did)
And the question is , how could i add the bar button which lead the view back?
i have tried to use
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:#"back" style:UIBarButtonItemStyleDone target:self action:#selector(Go)];
in function viewdidLoad, but it did not work, there's no bar or even button showed
UINavigationBar *bb = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44)];
self.NVBar = bb;
[self.view addSubview:bb];
However, i have no idea how to add a barbutton to the new navigationBar ---NVBar
Would you like to give me a solution?
You will need to pop the new view controller in order for the navigation bar to be automatically included.
In the view controller your code from above is in,
//*** Hook up four buttons to these actions and play around with it for a
//*** better sense of what is going on.
//*** JSBViewController is the name of my test class
//*** You should use your ViewController class that you are currently coding so
//*** you can see the difference of pop/push versus present/dismiss inside of a
//*** navigation controller
-(IBAction)push:(id)sender
{
JSBViewController * viewController = [self.storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([JSBViewController class])];
[self.navigationController pushViewController:viewController animated:YES];
}
-(IBAction)pop:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
-(IBAction)present:(id)sender
{
JSBViewController * viewController = [self.storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([JSBViewController class])];
[self presentViewController:viewController animated:YES completion:nil];
}
-(IBAction)dismiss:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
For the behavior you are looking for, you will need to use the push method
[self.navigationController pushViewController:viewController animated:YES];
If you use [self.navigationController pushViewController:picker animated:YES]; to push your nextVC, then the Nav Bar should stay at the top. Then you can pop back with ` [self.navigationController popViewControllerAnimated:YES];
It's quite unconventional to use a nav bar to go back from a modal view.
`
I have two classes, machineClass and buttonsClass... From buttons class, I want a button to programmatically push into the machineClass.
Ive gotten that to work with:
machineClass *mc = [self.storyboard instantiateViewControllerWithIdentifier:#"machineClass"];
mc.passedString = purchase;
[self presentViewController:mc animated:YES completion:nil];
However, this uses the default segue animation (where the view comes up vertically), and I think my app would look so much nicer if I used the cross dissolve transition instead.
Can anyone help? The best solution I've come up with is to change it to:
[self presentViewController:mc animated:NO completion:nil];
But I don't like this as much...
Thanks!
You can set the target view controller's modal transition style in the storyboard. Or in code:
machineClass *mc = [self.storyboard instantiateViewControllerWithIdentifier:#"machineClass"];
mc.passedString = purchase;
mc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:mc animated:YES completion:nil];
I used button action to to pop sub view sing below code;
- (IBAction)pickerUpBtn:(id)sender {
PickerPopUpController *screen = [[PickerPopUpController alloc]initWithNibName:#"PickerPopUpController" bundle:Nil];
[self.view addSubview:screen.view];
[self presentModalViewController:screen animated:YES];
}
after i need to go previous window; So i used another button action for it and add bellow code inside action
PickerViewController *screen = [[PickerViewController alloc]initWithNibName:#"PickerViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:screen animated:YES];
But It does not navigate to previous view . How could i do it ??
to go back,
do
[self dismissModalViewControllerAnimated:YES]
You need to put only that single code in the Button action..No need of making object of parentViewController.
ie,
-(IBAction)btnaction:(id)sender{
[self dismissModalViewControllerAnimated:YES];
}
You need to add cancel and done for your ViewController which is present modely to come back to parent view Controller.
After implementing the Cancel button, you have to dismiss your viewcontroller in the action function of Cancel button using the dismissModalViewControllerAnimated function
[self dismissModalViewControllerAnimated:YES];
For push view controller, you can do like below,
PickerViewController *screen = [[PickerViewController alloc]initWithNibName:#"PickerViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:screen animated:YES];
Then for go back, you have to add one button in "Screen" view controller and it's click event you have to write below code,
[self.navigationController popViewControllerAnimated:YES];
Hope, it would be helpful.
Let me know in case of any difficulty.
If you are using the method "presentmodelviewcontroller" then you have to write below line in button click.
[self dismissModalViewControllerAnimated:YES];
I want to present a modalViewController(do some picture drawing) right after dismiss the imagePickerController(exactly after finish image picking). I've tried to set up a IBAction with a bar button and it works fine when I tap it. But what I want is present the modalViewController as soon as I finish the image picking
Here is my code:
-(void)imagePickerController:(UIImagePicerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info{
[self dismissModalViewControllerAnimated:YES];
//dismiss the imagePickerController
drawViewController *drawView = [[drawViewController alloc] init];
[self presentModalViewController:drawView animated:YES];
}
Thanks!
The dismiss and presentModal can't both animate in the same method. The presentModal will seem to do nothing. For the dismiss, try setting the animated to NO.
After dissmissing the imagePickerController the viewDidAppear is called. You can there call the drawViewcontroller.
-(void)viewDidAppear:(BOOL)animated{
drawViewController *drawView = [[drawViewController alloc] init];
[self presentModalViewController:drawView animated:YES];
}
my application consist of a landscape view where i want to put a modalview but the problem is with modalview. it doesn't get load on presenting it.. code is:
--------------------code here----------------------
UIViewController *modalViewController = [[UIViewController alloc] init];
modalViewController.view = modelView1;
[self presentModalViewController:modalViewController animated:NO];
[self performSelector:#selector(hideSplash) withObject:nil afterDelay:5.0];
plz kindly help me with this....
The problem with ur code is that u are initializing it with alloc-init, without any nib name. Now when call:
[self presentModalViewController:modalViewController animated:NO];
The view will load itself by calling its loadview method, and u have definitely nothing in that. So if u do want to initialize in the same manner, just try to move the line of code:
modalViewController.view = modelView1;
after:
[self presentModalViewController:modalViewController animated:NO];
like:
[self presentModalViewController:modalViewController animated:NO];
modalViewController.view = modelView1;
I think this would work then.
Hope this helps.
thanks,
madhup