Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8375503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:11:39+00:00 2026-06-09T15:11:39+00:00

(My apologies for the long post) To jazz up my AQGridView, the attached code

  • 0

(My apologies for the long post) To jazz up my AQGridView, the attached code copies the selected cell into a UIView, then animates that view to expand to fill the screen, then have said view transform to look like a full screen cover animation. Feel free to reuse, but that’s not my problem. My problem is the animation for Landscape, which must be different. I wish to animate my cell view to the right half of the screen and expand to fill the right half of the screen (already accomplished) then have it do a y flip rotation across the screen to the left side. Anchor points at CGPointMake(0.5, 0.5); don’t work, and neither does setting the translate x value to half of the screen and back again, it just performs, then flies off the screen! HELP!!

EDIT: (The code is now working thanks to me not realizing that I had been adding the new UIView's to the self.navigationController.view property, so all it took was to render that and flip it, no translations needed!)
WORKING CODE:

if(UIInterfaceOrientationIsPortrait(viewController.interfaceOrientation)) {
            self.view.userInteractionEnabled = NO;

            [self.navigationController.view addSubview:viewForCopy];
            [self.navigationController.view bringSubviewToFront:viewForCopy];
            [viewForCopy setFrame:CGRectMake([_gridView rectForItemAtIndex:index].origin.x, [_gridView rectForItemAtIndex:index].origin.y + 65, [_gridView rectForItemAtIndex:index].size.width, [_gridView rectForItemAtIndex:index].size.height)];
            [viewForCopy setAlpha:1.0f];

            [[_gridView cellForItemAtIndex:index] setAlpha:0.0f];

            [UIView animateWithDuration:1.5f
                                  delay:0.0f
                                options:UIViewAnimationCurveEaseInOut
                             animations:^{
                                 [self.navigationController.navigationBar setAlpha:0.0f];
                                 [newShadow removeFromSuperlayer];
                                 [viewForCopy setFrame:CGRectMake(-158, 10, self.view.bounds.size.width * 1.55, self.view.bounds.size.height * 1.25)];
                                 [self.navigationController.navigationBar setAlpha:0.0f];  
                             } 
                             completion:^(BOOL finished) {
                                 [UIView animateWithDuration:2.0f
                                                       delay:0.0f
                                                     options:UIViewAnimationCurveEaseInOut
                                                  animations:^{
                                                      [viewForCopy setAlpha:0.0f];
                                                      CATransform3D _3Dt = CATransform3DIdentity;
                                                      _3Dt = CATransform3DTranslate(_3Dt, viewForCopy.frame.size.width * -1, 0, 0);
                                                      _3Dt = CATransform3DRotate(_3Dt, M_PI / -2.0f, 0.0f, 0.1f, 0.0f);  
                                                      _3Dt.m34 = 1.0f / 500.0f;
                                                      _3Dt = CATransform3DTranslate(_3Dt, viewForCopy.frame.size.width, 0, 0);
                                                      viewForCopy.layer.transform = _3Dt;
                                                      [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.navigationController.view cache:YES];
                                                      [self.navigationController pushViewController:viewController animated:NO];

                                                  } 
                                                  completion:^(BOOL finished) {
                                                  }];
                                 [[_gridView cellForItemAtIndex:index] setAlpha:1.0f];
                                 [self.navigationController.view sendSubviewToBack:viewForCopy];

                             }];
        }
             else if(UIInterfaceOrientationIsLandscape(viewController.interfaceOrientation)){
                 UIView *viewforCopyLandscape2 = [[[UIView alloc]initWithFrame:CGRectMake([_gridView rectForItemAtIndex:index].origin.x, [_gridView rectForItemAtIndex:index].origin.y + 65, [_gridView rectForItemAtIndex:index].size.width, [_gridView rectForItemAtIndex:index].size.height)]autorelease];
                 viewforCopyLandscape2.backgroundColor = [UIColor whiteColor];
                 viewforCopyLandscape2.alpha = 0.0f;

                 [self.navigationController.view addSubview:viewforCopyLandscape2];
                 [self.navigationController.view bringSubviewToFront:viewforCopyLandscape2];
                 [self.navigationController.view addSubview:viewForCopy];
                 [self.navigationController.view bringSubviewToFront:viewForCopy];

                 [newShadow removeFromSuperlayer];

                 [viewForCopy setFrame:CGRectMake([_gridView rectForItemAtIndex:index].origin.x, [_gridView rectForItemAtIndex:index].origin.y + 65, [_gridView rectForItemAtIndex:index].size.width, [_gridView rectForItemAtIndex:index].size.height)];

                 [[_gridView cellForItemAtIndex:index] setAlpha:0.0f];

                 self.view.userInteractionEnabled = NO;

                 [UIView animateWithDuration:1.5f
                                       delay:0.0f
                                     options:UIViewAnimationCurveEaseInOut
                                  animations:^{
                                      [viewforCopyLandscape2 setFrame:CGRectMake(0, 20, self.view.bounds.size.width/2, self.view.bounds.size.height)];
                                      [viewForCopy setFrame:CGRectMake(407, 10, self.view.bounds.size.width * .78, self.view.bounds.size.height * 1.25)];
                                      [self.navigationController.navigationBar setAlpha:0.0f];  
                                      viewforCopyLandscape2.alpha = 1.0f;
                                  } 
                                  completion:^(BOOL finished) {

                                      UIView *viewForCopyLandscape = [[[UIView alloc]initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.bounds.size.width, self.view.bounds.size.height)]autorelease];
                                      UIGraphicsBeginImageContext(CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height));
                                      [self.navigationController.view.layer renderInContext:UIGraphicsGetCurrentContext()];
                                      UIImageView *viewImage = [[[UIImageView alloc]initWithImage:UIGraphicsGetImageFromCurrentImageContext()]autorelease];
                                      UIGraphicsEndImageContext();
                                      viewForCopyLandscape = viewImage;
                                      [self.navigationController.view addSubview:viewForCopyLandscape];
                                      [self.navigationController.view bringSubviewToFront:viewForCopyLandscape];

                                      [viewForCopy setAlpha:0.0f];
                                      [UIView animateWithDuration:2.0f
                                                            delay:0.0f
                                                          options:UIViewAnimationCurveEaseInOut
                                                       animations:^{

                                                           CATransform3D transform = CATransform3DMakeRotation(-M_PI / 1.1, 0.0, 1.0, 0.0);
                                                           transform.m34 = 1.0f / 2500.0f;
                                                           viewForCopyLandscape.layer.transform = transform;

                                                           [self.navigationController.view sendSubviewToBack:viewForCopy];
                                                           [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.navigationController.view cache:YES];
                                                           [self.navigationController pushViewController:viewController animated:NO];
                                                           [viewforCopyLandscape2 removeFromSuperview];

                                                       }           
                                                       completion:^(BOOL finished) {
                                                           [[_gridView cellForItemAtIndex:index] setAlpha:1.0f];
                                                           [viewForCopy removeFromSuperview];
                                                           [UIView animateWithDuration:1.00 animations:^ {
                                                               [viewForCopyLandscape setAlpha:0.0f];

                                                           }];
                                                       }];
                                  }];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:11:40+00:00Added an answer on June 9, 2026 at 3:11 pm

    The code is now working thanks to me not realizing that I had been adding the new UIView’s to the self.navigationController.view property, so all it took was to render that and flip it, no translations needed!)

    if(UIInterfaceOrientationIsPortrait(viewController.interfaceOrientation)) {
                self.view.userInteractionEnabled = NO;
    
                [self.navigationController.view addSubview:viewForCopy];
                [self.navigationController.view bringSubviewToFront:viewForCopy];
                [viewForCopy setFrame:CGRectMake([_gridView rectForItemAtIndex:index].origin.x, [_gridView rectForItemAtIndex:index].origin.y + 65, [_gridView rectForItemAtIndex:index].size.width, [_gridView rectForItemAtIndex:index].size.height)];
                [viewForCopy setAlpha:1.0f];
    
                [[_gridView cellForItemAtIndex:index] setAlpha:0.0f];
    
                [UIView animateWithDuration:1.5f
                                      delay:0.0f
                                    options:UIViewAnimationCurveEaseInOut
                                 animations:^{
                                     [self.navigationController.navigationBar setAlpha:0.0f];
                                     [newShadow removeFromSuperlayer];
                                     [viewForCopy setFrame:CGRectMake(-158, 10, self.view.bounds.size.width * 1.55, self.view.bounds.size.height * 1.25)];
                                     [self.navigationController.navigationBar setAlpha:0.0f];  
                                 } 
                                 completion:^(BOOL finished) {
                                     [UIView animateWithDuration:2.0f
                                                           delay:0.0f
                                                         options:UIViewAnimationCurveEaseInOut
                                                      animations:^{
                                                          [viewForCopy setAlpha:0.0f];
                                                          CATransform3D _3Dt = CATransform3DIdentity;
                                                          _3Dt = CATransform3DTranslate(_3Dt, viewForCopy.frame.size.width * -1, 0, 0);
                                                          _3Dt = CATransform3DRotate(_3Dt, M_PI / -2.0f, 0.0f, 0.1f, 0.0f);  
                                                          _3Dt.m34 = 1.0f / 500.0f;
                                                          _3Dt = CATransform3DTranslate(_3Dt, viewForCopy.frame.size.width, 0, 0);
                                                          viewForCopy.layer.transform = _3Dt;
                                                          [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.navigationController.view cache:YES];
                                                          [self.navigationController pushViewController:viewController animated:NO];
    
                                                      } 
                                                      completion:^(BOOL finished) {
                                                      }];
                                     [[_gridView cellForItemAtIndex:index] setAlpha:1.0f];
                                     [self.navigationController.view sendSubviewToBack:viewForCopy];
    
                                 }];
            }
                 else if(UIInterfaceOrientationIsLandscape(viewController.interfaceOrientation)){
                     UIView *viewforCopyLandscape2 = [[[UIView alloc]initWithFrame:CGRectMake([_gridView rectForItemAtIndex:index].origin.x, [_gridView rectForItemAtIndex:index].origin.y + 65, [_gridView rectForItemAtIndex:index].size.width, [_gridView rectForItemAtIndex:index].size.height)]autorelease];
                     viewforCopyLandscape2.backgroundColor = [UIColor whiteColor];
                     viewforCopyLandscape2.alpha = 0.0f;
    
                     [self.navigationController.view addSubview:viewforCopyLandscape2];
                     [self.navigationController.view bringSubviewToFront:viewforCopyLandscape2];
                     [self.navigationController.view addSubview:viewForCopy];
                     [self.navigationController.view bringSubviewToFront:viewForCopy];
    
                     [newShadow removeFromSuperlayer];
    
                     [viewForCopy setFrame:CGRectMake([_gridView rectForItemAtIndex:index].origin.x, [_gridView rectForItemAtIndex:index].origin.y + 65, [_gridView rectForItemAtIndex:index].size.width, [_gridView rectForItemAtIndex:index].size.height)];
    
                     [[_gridView cellForItemAtIndex:index] setAlpha:0.0f];
    
                     self.view.userInteractionEnabled = NO;
    
                     [UIView animateWithDuration:1.5f
                                           delay:0.0f
                                         options:UIViewAnimationCurveEaseInOut
                                      animations:^{
                                          [viewforCopyLandscape2 setFrame:CGRectMake(0, 20, self.view.bounds.size.width/2, self.view.bounds.size.height)];
                                          [viewForCopy setFrame:CGRectMake(407, 10, self.view.bounds.size.width * .78, self.view.bounds.size.height * 1.25)];
                                          [self.navigationController.navigationBar setAlpha:0.0f];  
                                          viewforCopyLandscape2.alpha = 1.0f;
                                      } 
                                      completion:^(BOOL finished) {
    
                                          UIView *viewForCopyLandscape = [[[UIView alloc]initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.bounds.size.width, self.view.bounds.size.height)]autorelease];
                                          UIGraphicsBeginImageContext(CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height));
                                          [self.navigationController.view.layer renderInContext:UIGraphicsGetCurrentContext()];
                                          UIImageView *viewImage = [[[UIImageView alloc]initWithImage:UIGraphicsGetImageFromCurrentImageContext()]autorelease];
                                          UIGraphicsEndImageContext();
                                          viewForCopyLandscape = viewImage;
                                          [self.navigationController.view addSubview:viewForCopyLandscape];
                                          [self.navigationController.view bringSubviewToFront:viewForCopyLandscape];
    
                                          [viewForCopy setAlpha:0.0f];
                                          [UIView animateWithDuration:2.0f
                                                                delay:0.0f
                                                              options:UIViewAnimationCurveEaseInOut
                                                           animations:^{
    
                                                               CATransform3D transform = CATransform3DMakeRotation(-M_PI / 1.1, 0.0, 1.0, 0.0);
                                                               transform.m34 = 1.0f / 2500.0f;
                                                               viewForCopyLandscape.layer.transform = transform;
    
                                                               [self.navigationController.view sendSubviewToBack:viewForCopy];
                                                               [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.navigationController.view cache:YES];
                                                               [self.navigationController pushViewController:viewController animated:NO];
                                                               [viewforCopyLandscape2 removeFromSuperview];
    
                                                           }           
                                                           completion:^(BOOL finished) {
                                                               [[_gridView cellForItemAtIndex:index] setAlpha:1.0f];
                                                               [viewForCopy removeFromSuperview];
                                                               [UIView animateWithDuration:1.00 animations:^ {
                                                                   [viewForCopyLandscape setAlpha:0.0f];
    
                                                               }];
                                                           }];
                                      }];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies in advance for rather long post and lot of code. My application has
Apologies for the long code post but am wondering if someone can help with
Apologies for the rather verbose and long-winded post, but this problem's been perplexing me
Apologies in advance for the relatively long post - I've tried to provide as
My apologies for the long code sample. Here is my sample code: #include <iostream>
Apologies for the long post and I hope it makes some sense to someone
Please bear with me, my apologies if this post is too long... I'm attempting
Apologies for the long post, I have tried to provide you with as much
Apologies for the long post, but I wonder if I could get some more
Apologies I can't post any code at this time cos I'm away from my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.