• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iOS] How to add push animation to view controller without a navigation controller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iOS] How to add push animation to view controller without a navigation controller


  • Subject: Re: [iOS] How to add push animation to view controller without a navigation controller
  • From: Andreas Grosam <email@hidden>
  • Date: Fri, 10 Dec 2010 13:30:00 +0100

On Dec 10, 2010, at 6:52 AM, Tharindu Madushanka wrote:

> Hi,
>
> I would like to present my next view controller in a way that pushed in. But
> my first view controller is not a navigation controller.
>
> How could I do this. Is it possible ?

If you want a view to be animated in the same way as a view whose controller is pushed on the navigation stack, you may use CATransition. The following code shows how you may accomplish this task:

It is assumed, there is a view controller which currently displays its main view and a button in it as a subview. The user can tap the button, which causes the following action to be invoked:


// MyViewController implementation
#import <QuartzCore/QuartzCore.h>

- (IBAction) onButtonPressed:(id) sender
{
    UIImage* image = [UIImage imageNamed:@"MyFancyImage"];
    UIImageView* imageView = [[UIImageView alloc] initWithImage:image];
    imageView.frame = self.view.bounds;
    [self.view addSubview:imageView];
    [imageView release];

    CATransition* transition = [CATransition animation];
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromRight;
    [self.view.layer addAnimation:transition forKey:@"push-transition"];
}


The view originally seen (the controller's main view and the button) will appear to be moved out from right to left while a new view containing the image will be moved in. The status-bar will stay at its place.

Regards
Andreas

>
> Thanks and Kind Regards,
>
> Tharindu

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [iOS] How to add push animation to view controller without a navigation controller
      • From: Tharindu Madushanka <email@hidden>
References: 
 >[iOS] How to add push animation to view controller without a navigation controller (From: Tharindu Madushanka <email@hidden>)

  • Prev by Date: NSSegmentedControl in select any mode not working with textured appearance?
  • Next by Date: Re: [iOS] How to add push animation to view controller without a navigation controller
  • Previous by thread: [iOS] How to add push animation to view controller without a navigation controller
  • Next by thread: Re: [iOS] How to add push animation to view controller without a navigation controller
  • Index(es):
    • Date
    • Thread