Note that there are some explanatory texts on larger screens.

plurals
  1. PORecreate the default pushViewController animation programmatically (without a navigation controller)
    primarykey
    data
    text
    <p>I want to create a View outside of the visible screen and push in it (like the default pushViewController animation), but I cannot create the UIView outside. I was trying this code here, but it doesn't work. The View gets always created and displayed in the current UIScreen bounds. That means instead of both views, the one to get pushed out and the one to get pushed in, only the view that goes out "moves", the new view just sits at it's place.</p> <p>In the the .m of the view to show:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // set the views frame off the screen self.view.frame = CGRectMake(320, 0, 320, 460); } </code></pre> <p>In the method that actually does the transition:</p> <pre><code>-(void)showOverview:(UIViewController *)sender //sender = mapviewController { NSLog(@"overview"); // current view (frame) = mapviewCOntroller.view CGRect outFrame = self.view.frame; if (!self.overviewViewController) { self.overviewViewController = [[UCOverviewViewController alloc] init]; self.overviewViewController.transitionDelegate = self; // create a new View for the overview [self.overviewViewController.view setCenter:self.view.center]; [self.view.window addSubview:self.overviewViewController.view]; [self.view.window bringSubviewToFront:self.mapViewController.view]; } CGRect inFrame = self.overviewViewController.view.frame; outFrame.origin.x = outFrame.origin.x-outFrame.size.width; inFrame.origin.x = self.view.frame.origin.x; [UIView animateWithDuration:0.5f animations: ^{ [self.view setFrame:outFrame]; }]; } </code></pre> <p><strong>EDIT: this is my final code, at least the important part. Now, the view thats currently visible gets slider off screen at the same time the off-screen view gets slide in.</strong></p> <pre><code>-(void)showOverview { if (!self.overviewViewController) { NSLog(@"OverviewViewController created!"); self.overviewViewController = [[UCOverviewViewController alloc] init]; self.overviewViewController.transitionDelegate = self; // add the subView [self.view addSubview:self.overviewViewController.view]; [self.view sendSubviewToBack:self.overviewViewController.view]; } CGRect outFrame = self.mapViewController.view.frame; CGRect inFrame = self.overviewViewController.view.frame; outFrame.origin.x -= outFrame.size.width; inFrame.origin.x = self.view.frame.origin.x; self.isOverviewViewVisible = YES; [UIView animateWithDuration:0.5f animations: ^{ [self.mapViewController.view setFrame:outFrame]; [self.overviewViewController.view setFrame:inFrame]; }]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload