Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to crop an UITextView
    text
    copied!<p>I would like to have two UITextViews, one in the background and one in the front. Is there any possibility to crop 50% of the one in the foreground so that you can see 50% of the one in the background? I do not want to re-size the UITextView in the front, but merely to hide half of it.</p> <p>I think an illustration is in place as this might sound rather confusing:</p> <p><img src="https://i.stack.imgur.com/4gWw6.png" alt="enter image description here"></p> <p>I thought I do this with two view controllers, one hidden, one visible:</p> <pre><code>// Visible and Hidden View VisibleView *visibleController = [[VisibleView alloc] initWithNibName:@"VisibleView" bundle:nil]; self.visibleView = visibleController; [visibleController release]; HiddenView *hiddenController = [[HiddenView alloc] initWithNibName:@"HiddenView" bundle:nil]; self.hiddenView = hiddenController; [hiddenController release]; [self.view insertSubview:visibleView.view atIndex:0]; // show visibleView </code></pre> <p>Ideally, I would like to animate the 'hiding' of the visibleView Controller, so that the hiddenViewController unveils in the background (like a sliding door - sliding in from the right). This is what I've come up so far, but I can't think of any transformation / cropping technique that will do:</p> <pre><code>[UIView beginAnimations:@"Hide VisibleView" context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationTransition: ?? forView: self.view cache: YES]; [visibleView.view removeFromSuperview]; [self.view insertSubview:hiddenView.view atIndex:0]; [UIView commitAnimations]; </code></pre> <p>I guess this is quite basic, but I'm still a beginner and would be very happy over any suggestions of how to accomplish this.</p>
 

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