I am using the following code for page curl animation
[UIView beginAnimations:#"yourAnim" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:yourView cache:cacheFlag];
...
[UIView commitAnimations];
Is it possible to make the half curl animation like the maps.app on iphone/ipod ?
Any ideas how to make an similar effect ?
Thanks
Apple does support this for the presentation of modal views as of 3.2. This makes sense: the page curl effect is intended to signal the user that a page of options or settings is being revealed, and when they are done changing things, they will be sent back to the original view. Apple doesn't want the animation to infer an ongoing change to the page hierarchy, just a modal one that must return to its starting place.
It's pretty straightforward to use; just be sure that you are starting from a full screen view, and loading with the UIModalPresentationFullScreen style, which I believe is the default.
There are animation transitions to use a similar effect in UIViews generally that were added as of 4.0, but this is a straightforward way to use the effect.
simpleVC * myModalVC = [[simpleVC alloc] init];
[myModalVC setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[myModalVC setDelegate:self];
[self presentModalViewController:myModalVC animated:YES];
[simpleVC release];
Link to Apple Docs on UIModalTransitionStyle constants
I too have been working on this issue and I settled in the short term on a PNG version of it placed within a button and using the curl to reveal animation. The only thing missing in my solution is the ability to interact (play) with the curling page the way you can in Maps.
The Method
First, I created a Page corner PNG in Photoshop based on a screenshot of Maps.
The Map Curl PNG
The Map - Options Hidden
The Map - Options Revealed
Then, I added it to a UIButton that does a partial page curl transition.
Complete Source Code Available on GitHub
The complete working project is available at GitHub. Updated for iPhone 5.
Use the undocumented animation types mapCurl and mapUnCurl
Related
Hope there are some GLKViewController experts out there because I have some problems :)
Just a quick description of my app. I have a UINavigationController in which I push different screens.
At some point, I get to my game screen which is a subclass of UINavigationController. In this screen, in viewDidLoad I manually create a EAGLContext, GLKView and instantiate a new GLKViewController (to handle my update&draw calls).
I am setting a preferred fps of 30.
The problem is that the first 3-4 update calls come with the correct DT, but then I have 2-3 frames with 1 second between them. I measure the DT using controller.timeSinceLastUpdate.
So I get like:
dt=0.33
dt=0.33
dt=0.33
dt=1.07
dt=1.05
dt=0.33
dt=0.33
After this, I get valid only DT times. I have no idea why those frames have that kind of delay. I measured the time it takes me in the update & draw method, and it's nowhere near 1 second.
Also, I'm not loading any textures/creating any geometry. Everything is done at loading since it is a rather small game.
Also, if I pop the game screen controller and then push back another instance of the game screen, this new GLKViewController will only call my update method aproximately every 1 second.
Did anybody have a problem with the framerate when using GLKViewController?
Thanks,
The problem is that you don't know what else the device is doing between your refreshes :)
You might only spent 0.1s working on the next frame but if there is a memory warning then other bits of your app will also take time to process. I guess that the gl controller will do it's best to keep to the preferred frame rate but if lots is going on in the background then there's not much it can do about it.
As long as you make sure that your code is rendering as fast as possible and isn't spiking in the same way as the framerate then it's not your render path. From your question it sounds like you've already tested that.
The other thing you might want to do is to watch out for other notifications that might be passed into your app (i.e. memory warnings).
Finally, is there a pattern to the slow frames - do they coincide with a new image being loaded or a file access? Have you done as much as possible beforehand? EDIT - rereading your question makes me think that you've already done this, sorry!
Sorry I can't be any more use :(
Ok, so I finally figured it out. It turns out that it's not even related to the GLKViewController (surprise surprise!).
It had something to do with the way I'm displaying the game screen view controller, like this:
GameAreaViewController* gameController = [[GameAreaViewController alloc] init];
[UIView beginAnimations:#"animation" context:nil];
[self.navigationController pushViewController: gameController animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView setAnimationDuration:0.7f];
[UIView commitAnimations];
SAFE_DEL(gameController);
If I use an animation duration of 0.3f, then I don't get any lag. At 0.5f sometimes I get it and at 0.7 I was always getting it.
I have been reading all the Apple documentation on how to handle various events with their touch screens. My problem is this:
I have an iframe in my webpage. Occasionally it is overfilled (this part is handle properly with the overflow attribute) and I cannot scroll the frame. The scroll bar pops up, but a swipe scrolls down the whole web page.
Apple says something to the effect of "... a swipe calls window.scroll() by default...". I have read various articles that say its POSSIBLE to change the default behavior for certain DOM objects, or disable it, or create your own behavior, etc. It sounds like any number of these solutions COULD work for me, but I can not find any examples nor fasion my own.
Can anyone help me with a link or example of an easy way to modify the style/events/attributes of my iframe so that I can scroll it with a normal one finger swipe on an iDevice?
Please Use,,UISwipeGestureRecognizer
...
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:#selector(handleSwipeRight:)];
swipeRight.numberOfTouchesRequired=1;
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];
[swipeRight release];
}
- (void)handleSwipeRight:(UISwipeGestureRecognizer *)recognizer
{
//Your Coding
}
although NOT a solution to this problem, i solved my problem using this website -- webmanwalking.org/library/experiments/… -- i directed my ipad to the site, saw it function correctly, then made my page behave the same way. the biggest hurdle for me was i never knew there even WAS a multi finger swipe!
controller.modalTransitionStyle = UIViewAnimationTransitionFlipFromLeft;
[self presentModalViewController:controller animated:YES];
Is there any way to make it flipping with a thick border/side? (like iBooks app, when you're switching between books view and the books store)
The code or API Apple used for this transition is not publicly available, so you would need to implement your own custom OpenGL transition. Lucky for you, someone else had the same idea and implemented a helper class that includes a thick-border flip transition: EPGLTransitionView. If this is not to your liking, check out this SO thread on custom view transitions.
EPGLTransitionView uses OpenGL. Try this project instead, fully done in CoreAnimation:
https://github.com/devindoty/iBooks-Flip-Animation
1) Is it possible to change the speed of autorotation on the iPhone?
2) Is it possible to time an animation to take place during the autorotation animation? I would like to resize a photo while rotation is occuring, rather than when it's done.
1) not that I know of
2) Yes, see this method:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW53
As for the first question, I haven't used this but check it out:
[UIApplication sharedApplication].statusBarOrientationAnimationDuration = [NSTimeInterval ...];
See docs for UIApplication. The problem is that I don't know that this actually rotates the rest of your views. You may, however, be able to rotate the window's coordinate system around "manually" using UIWindow and [UIView beginAnimations ...] in order to recreate the whole effect.
Please post sample code somewhere if you get it working!
I'm pretty sure I can create a page flip effect using a series of PNGs to simulate the animation but is there a way to do it programmatically? Tried googling it and looking at Apple sample code but didn't see anything addressing that particular animation.
I'm assuming you mean for an iPhone, right?
From the Apple API docs for UIView:
+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache
where UIViewAnimationTransition is defined as:
typedef enum {
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight
UIViewAnimationTransitionCurlUp,
UIViewAnimationTransitionCurlDown,
} UIViewAnimationTransition;
UIViewAnimationTransitionCurlUp is what you are looking for. See those docs for information on how to start, set, and commit animations to views as well.