-2

i need to implement two different views, one for a map and the other for a list. And that i want is to switch the view to the other when we click on a button. I know how we can do with two different views that we hide, but i want that like with the viewflipper for android the views switched like one view which is split into two like this :

http://www.youtube.com/watch?v=SZTiJmclaRc

Thx.

ps: sorry for my english, i'm not very fluent in english.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 1
    UIScrollView? UIAnimation with Slide transition? – Larme Jan 23 '14 at 11:58
  • I don't know if there is a problem if we put just one view and one table view. In fact i need to custom the table view with data that i retrieve on internet. That's why i have a class for the table view, so i need two different controllers, but i don't know if it is possible to have a link like you say with two views in the same controller. – Gauthier Beignie Jan 23 '14 at 12:10

2 Answers2

1

You could use a CATransition to achieve this sort of effect quite easily. For example:

CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.3f;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromRight;
[self.view.layer addAnimation:animation forKey:@"transition"];

// swap out your views here - either add / remove subviews or show / hide subviews
[self.view addSubview:otherView];

When animating the other way, change the subtype to kCATransitionFromLeft.

You'll also need to link to the QuartzCore framework, and import <QuartzCore/QuartzCore.h>

James Frost
  • 6,960
  • 1
  • 33
  • 42
0

Just use a UIPageViewController, a working example you can download here: How to Use UIPageViewController to Build Tutorial Screens

It looks what you are looking for.

Artur Kucaj
  • 1,071
  • 1
  • 11
  • 16
  • No, i need to stay on the same page, because i use data for annotations on my mapView and for the tableView at the same time. It is quicker to stay in the page than in two different page. – Gauthier Beignie Jan 23 '14 at 13:35
  • Maybe i have misunderstand, i think it is a good solution if we could implement a map and a tableview – Gauthier Beignie Jan 23 '14 at 13:39
  • Do you think it is possible to switch the action ? i mean, it is possible to change the fact that the user slide to switch the different page by a button which allow to switch to the other view ? – Gauthier Beignie Jan 23 '14 at 13:45