Note that there are some explanatory texts on larger screens.

plurals
  1. POShrink UIView from left to right
    primarykey
    data
    text
    <p>I have the following code to shrink a UIView from left to right and remove it from super view after the animation finished:</p> <pre><code> UIView* coverView = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 300, 50)]; UIImageView* imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"swipe_rl.png"]]; [imageView setContentMode:UIViewContentModeScaleToFill]; [imageView setFrame:coverView.bounds]; [coverView addSubview:imageView]; [coverView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; coverView.clipsToBounds = YES; [self.view addSubview:coverView]; CGRect frame = coverView.frame ; [UIView animateWithDuration:5.0 animations:^{ [coverView setFrame:CGRectMake(frame.origin.x + frame.size.width, frame.origin.y, 0, frame.size.height)]; } completion:^(BOOL finished){ [coverView removeFromSuperview]; }]; </code></pre> <p>However, the left part of the picture stays and the right part of the picture disappears as you can see in the pictures. For a specific purpose, I want the left part disappears and the right part stays. How can I do it?</p> <p>For those who want to know why I want this: </p> <pre><code>- Basically, I want a display-from-left-to-right animation (It means you have a picture and the left of the picture appears first and the the middle and the whole picture appears) - I do this by adding a second view above the first picture and then shrink the second view from left to right. The first view will then be revealed from left to right. - Look at http://i1289.photobucket.com/albums/b510/yenmach/right_to_left_zps80b9e9bb.jpg and http://i1289.photobucket.com/albums/b510/yenmach/left_to_right_zps9214dc4a.jpg </code></pre> <p><img src="https://i.stack.imgur.com/86fsQ.jpg" alt="shrink from the beginning"></p> <p><img src="https://i.stack.imgur.com/ePmYB.jpg" alt="shrink in the middle of animation"></p>
    singulars
    1. This table or related slice is empty.
    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