UIViewAnimationCurveLinear Hide View Completely - iphone

I'm trying to switch between two views by using the page curl effect in UIViewAnimationCurveLinear but when I execute this animation, the top of the page curl stays present on the second view.
I implement this action by using
-(IBAction)menu:(id)sender{
MenuViewController *view=[[MenuViewController alloc] initWithNibName:nil bundle:nil];
view.modalTransitionStyle=UIViewAnimationCurveLinear;
[self presentModalViewController:view animated:YES];
}
Anyone know how to completely remove the previous view from the screen? Thanks in advance.

UIViewAnimationCurveLinear is not a modal transition style. If you want page curl then you probably want UIModalTransitionStylePartialCurl.

Related

How to dismiss the view

I have used the below code to show the view with partial curl effect.
And it works fine but I want to know that how can i dismiss the popoverViewController when touching the curl effect as like in the map application in the iphone.
thanks for any help
UINavigationController *navPop = [[UINavigationController alloc] initWithRootViewController:popoverViewController] ;
[popoverViewController release];
[popoverViewController setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:navPop animated:YES];
actually i know the code to dismiss the view but , wat i need to know is i want to dismisss it by clicking on the curl effect.. this is wat i would like to know
Use the dismissModalViewControllerAnimated: method.
You are setting modalTransitionStyle of wrong object, I guess. As you are presenting navPop you should set the property to it:
[navPop setModalTransitionStyle:UIModalTransitionStylePartialCurl];
When you would like to dismiss it, just call:
[navPop dismissModalViewControllerAnimated:YES];
And you will see curl effect

curl up navigation on view based application in ios apps

i have faced some problem while navigating from one class to another with the curl-up animation style
i have did 2 test projects one with View based application & another navigation based application & also created 2 classes in each and a button on the first screen
following is my event handler for that button
-(IBAction)OnclickButton
{
SecondViewController * viewController = [[[SecondViewController alloc] initWithNibName:nil bundle:nil] autorelease];
[UIView transitionWithView:self.view.window
duration:1.0f
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
[self.navigationController pushViewController:viewController animated:NO];
}
completion:NULL];
}
my problem is
project with navigation based template is working fine its navigating to second page with curl up animation ,,
but
in the project with navigation based template ,its not navigating to the second page on click of the button instead it will give curl up effect n reload the same page
why its happening so,, i am planing to apply this curl up animation to my existing project which is created in view based template
can any one tell where i gone wrong,,, how can i navigate with curl up animation(but not using the partial animation API)
thanx in advance
B'coz you set self.view
transitionWithView:self.view.window
you need to change view which you call..

ipad pushViewController display not as full screen

How to push an ViewController display not as full screen on iPad like the image below
Welcome any comment
Use UIViewController's modalPresentationStyle property, along with the standard presentModalViewController:animated:. Your screenshot is using UIModalPresentationFormSheet. There is also UIModalPresentationPageSheet, which displays fullscreen in portrait mode but leaves borders on either side in landscape.
The image you are showing is a type of modal view. You would display it with something like:
myViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[myViewController presentModalViewController: myModalViewController animated:YES];
See the documentation on UIViewController's for more info on modal views.
We can present the modalViewController in four different way .ie
1. UIModalPresentationFullScreen
2. UIModalPresentationPageSheet
3. UIModalPresentationFormSheet
4. UIModalPresentationCurrentContext.
Here you are using third One now..
if you dont want to use these thing simply use the following code..
[self presentModalViewController Animated:YES];
From the screenshot I take it that you're doing something like this:
UIViewController* newController = LoadTheController();
newController.modalPresentationStyle = UIModalPresentationFormSheet;
[currentViewController presentModalViewController:vc animated:YES];
But your question is referring to the "pushViewController" method, which is related to UINavigationController objects, and there is indeed a navigation controller in the background of the screenshot. You might try looking into something like this:
[currentViewController.navigationController pushViewController:vc animated:YES];

How come presentModalViewController is not working the second time?

I am using a tab based application that shows a presentModalViewController called "overview" that has 2 buttons on it .
In order to call it I am using the following code in app delegate:
Overview *overview = [[Overview alloc] initWithNibName:#"Overview" bundle:nil];
[self.tabBarController presentModalViewController:overview animated:YES];
When overview shows up, it has a button called that gets clicked and I am using the following code:
-(IBAction) btnLoginPressed{
[self dismissModalViewControllerAnimated:YES]; //get rid of view
Login *login = [[Login alloc] initWithNibName:#"Login" bundle:nil];
[self.tabBarController presentModalViewController:login animated:YES];
[login release];
}
However the login prsentModalViewController never shows up. Can someone explain why and what I can do to show it?
Thanks
When you present a modal view controller, you do it from the view controller currently in the view.
Assuming your second modal display of a view controller is happening in Overview.m change your code to the following:
-(IBAction) btnLoginPressed {
Login *login = [[Login alloc] initWithNibName:#"Login" bundle:nil];
[self presentModalViewController:login animated:YES];
[login release];
}
You don't need to dismiss Overview first, and in fact you shouldn't as it the animations won't work in conjunction with each other.
When you ultimately dismiss login (or however deep you want to go), you send dismissModalViewController:animated: as high up as you need to. To get back to the tab bar's controller use:
[self.tabBarController dismissModalViewController:animated]
It would be well beyond the scope of your question and the time I have to answer but you should take some time and really study the docs on implementing View Controllers. I definitely recommend following Apple's code style guidelines as one suggestion to make your code much more readable (e.g. overviewViewController vs overview). It's also clear you're just learning so keep at it.

how can I call a screen with a button action (xcode)?

I am developing a Window Based app for iPhone. I use Interface Builder to build Interface. I want to call a new screen with a Button Action. How can I call the screen with Button action ?
By pushing the new controller onto the top of the stack of windows. For example:
EnterNameController *newEnterNameController = [[EnterNameController alloc] initWithNibName:#"EnterName" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:newEnterNameController animated:YES];
Apple has an extraordinary amount of sample code, and this question (as well as many others) could easily be solved by simply visiting Apple's iPhone dev site.
iPhone Dev Site
If you are using a navigation controller, push it onto the navigation controller's stack, as alamodey suggested.
If you want it to be a modal controller (that is, slide up from the bottom and cover the previous controller's view, like the Bookmarks screen in Safari), present it as a modal view controller:
[self presentModalViewController:myNewController animated:YES];
When you want to bring the old controller back, dismiss the modal view controller. From inside the modal view controller:
[self.parentViewController dismissModalViewControllerAnimated:YES];
If you don't want to do either, just remove the current controller's view from the window and add the new controller's:
UIView * containingView = self.view.superview;
[self.view removeFromSuperview];
[containingView addSubview:myNewController.view];
If you go this route, you may want to look into +[UIView beginAnimations:context:], +[UIView setAnimationTransition:onView:], and +[UIView commitAnimations] (if I recall the method names correctly--check the documentation) to animate the transition. You should almost always animate any switch between screens in iPhone OS.
(work in .m class)
#import "classtocall.h"
- (IBAction)ButtonPressed:(id)sender
{
classtocall *mvc = [[classtocall alloc]initWithNibName:#"classtocall" bundle:nil];
[self presentModalViewController:mvc animated:NO];
}
(for window based application)
define in .h class
- (IBAction)ButtonPressed:(id)sender;
where "classtocall" is the class you want to call.
you just need to download sample applications from XCode help. Try Elements and UIcatalog. There are also other - type 'pushViewController' or 'addSubview' adn 'makeKeyAndVisible' in help and download samples
nextscreenViewController *login = [[self storyboard] instantiateViewControllerWithIdentifier:#"nextscreenidentifier"];
nextscreenidentifier.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController: nextscreenidentifier animated: YES];