Any alternaitve to the Google Map mapcurl? - iphone

Does anyone know how to mimic the map curl in the Google Map application without using the undocumented mapCurl and mapUncurl API?
Ideally I would like to do the same thing as the Google Map application. If this is not possible, is there any way to 'slide' the map image up to show the options?

SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
[sampleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:sampleView animated:YES];

[UIView transitionFromView:self.view toView:overlayView duration:1 options:UIViewAnimationOptionTransitionCurlUp completion:nil];
Will do the animation of the page curl up if thats what you mean. I haven't found a way to pause it half way like the google maps app does, but in theory if you implement the UIView animation delegate methods you might be able to pause it half way or something.
EDIT:
[UIView transitionFromView:overlayView toView:self.view duration:1 options:UIViewAnimationOptionTransitionCurlDown completion:nil];
is the curl down implementation of it.
Just so you are aware overlayView is UIView, not a UIViewController, not that it should matter but thats how I implemented it.

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

UIView being pushed up (apparently)inexplicably

I have a problem with UIViews to which I really don't know how to proceed.
It will be futile to describe my problem so here are the screenshots of before and after.
Somehow the UIView gets the layout that was defined in interfacebuilder AFTER an image is chosen. Before an image is chosen it doesn't obey to its defined layout for some reason.
Before using imagePicker for picking an image:..........................After Picking image:
|
So yeah that is basically the problem. The black squares are other images and you can tell by that how it should and how it shouldn't, one of the images is being cut (normally behind the "No SIM" label.) I just put them to hide the real images on the screenshots.
So maybe is something in relation to two things I do here.
I resize the image chosen to 320-480 and put it on a smaller UIImageView before uploading it to a server.
If the user is writing on a textField the entire view is animated up, so the keyboard won't hide the textFields.
UPDATE:
I noticed this happens on a UIView that does nothing related to resizing images or textFields. This is happening too on a UIView I have where there are only 3 buttons and 2 labels. Only 5 elements. The 3 buttons are in custom mode with images. So 3 image~Buttons and 2 labels....
Thank you for your help and suggestions fellow Stackoverflowers!!! (Stackoverflowerers?)
I really have no idea on how to proceed here, though I've been playing around transforming the UIView at the viewDidLoad to no avail.
UPDATE 2:
I started to think that maybe there is something wrong with the code I use to make the transition from view to view and has nothing to do with the elements that are contained in it. Since it is happening in all my views EXCEPT the first view. So here is the code I use for the transition of views:
- (void) flipToUploadView {
UploadViewController *aUploadView = [[UploadViewController alloc] initWithNibName:#"UploadView" bundle:nil];
[self setUploadViewController:aUploadView];
[aUploadView release];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
[uploadViewController viewWillAppear:YES];
[viewController viewWillDisappear:YES];
[viewController.view removeFromSuperview];
[self.window addSubview:[uploadViewController view]];
[viewController viewDidDisappear:YES];
[uploadViewController viewDidAppear:YES];
[UIView commitAnimations];
}
Sorry don't have enough reputation to comment, but
have both views the same nib?
if not, is it possible that you just forgot to simulate the status bar in InterfaceBuilder for the few which is drawn uncorrect? and thats why the positions are different?
And i think what Tommy means is that normally you use the ModalViewcontroller to change views
[self presentModalViewController:uploadViewController animated:YES];
than all the function calls (willappear,didappear,willdissappear...) are called automatically
but i think this is not the source of the wrong displaying

Sequential (not hierarchical) navigation in iPhone

I'm getting frustrated at this.
I want to create an iPhone application to show a list of events, one day for each 'screen'. I want a bar at the top with 'next' and 'prev' buttons that allow me to go to tomorrow or yesterday.
It is not a UINavigationController style navigation, because navigation is not hierarchical. Therefore I don't think I should use the pushViewController: method, as many examples and tutorials suggest.
I think that the appdelegate class should remove the current view and create a new viewcontroller and view and add it to the window. However I can't manage to get it working. Also I would like nice transitions.
Can someone point to a code sample that I can look at?
Thank you.
P.D. My question is similar to this one but there is no useful answer.
I wouldn't get hung up on the view controller so much. The view controller/view duality can sometimes get in the way of building custom interfaces.
What you need is a UIToolbar with two buttons, and a sorted array of UIView objects configured appropriately for your entities.
Then when the buttons are clicked, simple [UIVIew animations] should get the job done.
I'm not going to write the code for you. Any casual analysis of the build in UIView animation components will point you on your way.
The only real thing I can tell you is that, having built sophisticated interfaces for the iPhone, the biggest learning curve is knowing when and when not to use UIViewController as opposed to UIView. This is tricky because most of the standard apple components use Controller.
Now it works. Just some details were missing. I'll leave the answer here so that other people can comment on it or use it.
In the AppDelegate class I added this method:
-(void) navigateToDay:(NSDate*) newDay fromDay:(NSDate*) currentDay
{
UIViewAnimationTransition transition = ([newDay compare:currentDay]<0)? UIViewAnimationTransitionCurlDown :
UIViewAnimationTransitionCurlUp;
SequentialNavigationViewController* newController = [[SequentialNavigationViewController alloc] initWithNibName:#"SequentialNavigationViewController" bundle:nil];
newController.app = self;
newController.currentDay = newDay;
[newController.view setFrame:[[UIScreen mainScreen] applicationFrame]];
[UIView beginAnimations:#"transition" context:NULL];
[UIView setAnimationDuration:0.50];
[UIView setAnimationTransition:transition forView:self.window cache:YES];
[window addSubview:newController.view];
[self.viewController.view removeFromSuperview];
[UIView commitAnimations];
self.viewController = newController;
[newController release];
}
And I call this method from the SequentialNavigationViewController prevButtonClicked and nextButtonClicked methods.
Not so hard after all!

How can I display a introduction modal view when the app start up?

I have a tab bar application and I want to display those views that most part of apps have, with the name of the company or the name of the app.
I've created the follow viewController
Introduction *introducao = [[Introduction alloc] initWithNibName:#"Introduction" bundle:nil];
I don't know where exactly should I insert the code to show the modal because I have a tab bar application:
[self.navigationController presentModalViewController:galeria animated:YES];
I've tried to insert these lines on appDelegate.. but didn't work.. somebody have an idea?
if you are trying to show a splash screen right when the application opens, you should use a Default.png image instead of a view controller showing an image. Check out the Apple Documentation on Human Interface Guidelines and Beginning iPhone Development.
First of all, you'll need to ensure that you have a navigation controller present to present the model view from. Otherwise in the above code you'll be messaging nil and nothing will happen. Then you'll want to put the presentModalViewController:animated: call in your app delegate's applicationDidFinishLaunching: implementation.
Thanks for all answers.. they were very useful to understand better the process..
I have found a solution that does exactly what I need! So if someone need to create those splash screens with a sequence of images it is very useful:
Just create a ImageView on the Delegates Header and do the following:
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
splashView.image = [UIImage imageNamed:#"Default.png"];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
to control the duration of the splash screen:
[self performSelector:#selector(removeSplash) withObject:nil afterDelay:1.5];
To remove the splash:
-(void)removeSplash;
{
[splashView removeFromSuperview];
[splashView release];
}
so If you want to create a sequence of image just create a method to change the splashView.image.. and create a NSTIMER to call it..

provide transitions between view controllers

i am new to iphone application development.
I have a mainmenu view controller, which has a login button.
once i click the login button i display the next login view controller by calling this
LoginController *lc2=[[LoginController alloc] initWithNibName:#"LoginController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:lc2];
[self presentModalViewController:navigationController animated:YES];
But this view appears to come from the right side of the screen,i want to provide the effects like, curl or flip,when i navigate from one view controller to another.
Please help me with the code to provide this effect
Check the Metronome example from Apple's SDK. Its a bit too much code for posting it right here, hence I would like to point you to that example.
The basic idea is using a parent view-controller that handles the transitions between two or more child view-controllers. That involves setting up a protocol for smoothly allowing the child-view-controllers to inform the root-view-controller about transitions to do. Bit vague, I know - so please jump into the example code.
Perhaps something like this, separating the animation code from the modal view controller's presentation code:
LoginController *lc2=[[LoginController alloc] initWithNibName:#"LoginController" bundle:nil];
UINavigationController *navigationController =
[[UINavigationController alloc]initWithRootViewController:lc2];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:YES];
[self presentModalViewController:navigationController animated: NO];
[UIView commitAnimations];
I quite agree with luvieere, except I think that the view specified in
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:YES];
must be the container view, in wich a subview will be added or removed, and I'm not sure if navigationController.view is the container view. I would try with different combinations, including self.view, self.view.superview (that depends of the behavior of "presentModalViewController").