IPhone SDK: UIModalTransitionStyleFlipHorizontal optimization

I want to flip my new ModalView with very high performance, but the new View has a lot of sub-tasks, so the Flip-Effect performance is very poor. I actually do it with:

[controller setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:backSideController animated:YES];

      

I also tried it with

CATransition *transition = [CATransition animation];
transition.duration = 0.75;
[transition setType: @"flip"];
[transition setSubtype:@"fromRight"];

transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[transition setFillMode:@"extended"];

[[self.view layer] addAnimation:transition forKey:nil];


[self.view addSubview: backSideController.view];
[CATransaction commit];

      

With Core-Animation, it runs a little faster ... Are there any other ways to build on this task? e.g. Adding a view when the animation stops and just displaying a screenshot before the animation stops?

+2


source to share


1 answer


Try to access backsideController.view before starting the animation. This will call the backsideController loadView and viewDidLoad. I guess this is your success - anything that loads and highlights makes the animation stutter.

You don't need anything, you can do something like:

if (backsideController.view == nil)
    NSLog(@"Where my view?!");

      



before the other code above.

I don't think having many, many subqueries causes performance issues per flip; I'm pretty sure (without looking at your code or checking the tools you should be doing!) That the problem is the time it takes to load and highlight the view components.

Also, I would stick presentModalViewController

with if it does what you want. Having all this extra code in your second example - unless you need it for functionality - is just a maintenance headache.

0


source







All Articles