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 8348501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:42:28+00:00 2026-06-09T07:42:28+00:00

I’m trying to animate a UIWebView on to the screen from the right border

  • 0

I’m trying to animate a UIWebView on to the screen from the right border when a link is tapped. In order to do this, I’m using two UIViews. One called onScreenWebView and another called offScreenWebView. The idea is that I can animate the offscreenWebView onto the screen from the right, and animate the onScreenWebView off the screen to the left. Then swap the views (so the view on screen becomes the onScreenWebView and vice versa) but my animation is having problems. I must note it works great THE FIRST TIME. After that it doesn’t work well at all.

The views are aligned as such

      __________ __________
      |        | |        |
      |   on   | |  off   |
      | screen | | screen |
      |________| |________|

Here’s the animation code :

offScreenWebView.hidden = true;

offScreenWebView.frame = self.frame;
[offScreenWebView offSetX:self.bounds.size.width + kOffsetPadding];         // move offscreen to the right
[self logWebRects:@"begin"];
offScreenWebView.hidden = false;
[self bringSubviewToFront:offScreenWebView];

[UIView animateWithDuration:0.5f delay:0.0f options:UIViewAnimationCurveEaseInOut animations:^{
    [self logWebRects:@"during 1"];
    offScreenWebView.frame = self.frame;
    onScreenWebView.frame = CGRectMake(-(self.bounds.size.width + kOffsetPadding), 0, onScreenWebView.bounds.size.width, onScreenWebView.bounds.size.height);
    [self logWebRects:@"during 2"];
}completion:^(BOOL finished) {
    [self logWebRects:@"finished b4 swap"];
    [self swapWebViews];
    [self logWebRects:@"finished -- done"];
}];

Here is the output of my logWebRects method (just the origin of each view)

Navigation Type ::      Link Clicked
Rect of self frame   ::  {{0, 0}, {320, 460}} 

99  --  Point of offscreen origin   begin          ::  {335, 0}
0   --  Point of onscreen origin    begin          ::  {0, 0}
99  --  Point of offscreen origin   during 1       ::  {335, 0}
0   --  Point of onscreen origin    during 1       ::  {0, 0}
99  --  Point of offscreen origin   during 2       ::  {0, 0}
0   --  Point of onscreen origin    during 2       ::  {-335, 0}
Navigation Type ::      Other
99  --  Point of offscreen origin   finished b4 swap       ::  {0, 0}
0   --  Point of onscreen origin    finished b4 swap       ::  {-335, 0}
0   --  Point of offscreen origin   finished -- done       ::  {-335, 0}
99  --  Point of onscreen origin    finished -- done       ::  {0, 0}


Navigation Type ::      Link Clicked
Rect of self frame   ::  {{0, 0}, {320, 460}} 

0   --  Point of offscreen origin   begin          ::  {335, 0}
99  --  Point of onscreen origin    begin          ::  {0, 0}
0   --  Point of offscreen origin   during 1       ::  {335, 0}
99  --  Point of onscreen origin    during 1       ::  {0, 0}
0   --  Point of offscreen origin   during 2       ::  {0, 0}
99  --  Point of onscreen origin    during 2       ::  {-335, 0}
Navigation Type ::      Other
0   --  Point of offscreen origin   finished b4 swap       ::  {335, 0}
99  --  Point of onscreen origin    finished b4 swap       ::  {0, 0}
99  --  Point of offscreen origin   finished -- done       ::  {0, 0}
0   --  Point of onscreen origin    finished -- done       ::  {335, 0}

These logs are from the initial run. Then also the second run. You’ll notice that for whatever reason, the animation block is resetting the frame of each web view just before the completion block.

I should note that I swap the web views with a classic temp-variable swap. Also, they are sibling views.

  • 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-09T07:42:30+00:00Added an answer on June 9, 2026 at 7:42 am

    I have a similar set up to yours in one of my apps. Unfortunately I can’t see anything significantly wrong with your implementation (though we can’t see your swapping and logging methods). Mine doesn’t call out to other methods or do as much work with frames. I did have a problem with a temp variable swap so reverted to using the next view controller as a parameter to the method, it worked much better.

    centreOffRight and centreOffLeft are CGPoints defining the centre of the screen offset to the left and right respectively. next and previous are the view controllers for each view. This method is called from a container view controller.

    -(void)moveNext:(PlayerViewController*)sender
    {
        // Need to push this one from the right
        next.view.center = centreOffRight; 
        [self.view bringSubviewToFront:next.view];
        [UIView animateWithDuration:0.3 
                         animations:^{
                             next.view.center = centreOfScreen;
                             current.view.center = centreOffLeft;} 
                         completion:^(BOOL finished){ 
                             [current wasMovedOffScreen];
                             current = next;
                             next = sender;
                             currentDouble = nextIndex;}];
    
    }
    

    I’m reluctant to post this as an answer as I can’t see why this would work when yours doesn’t, but hopefully it helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.