cgaffinetransform

Get just the scaling transformation out of CGAffineTransform

依然范特西╮ 提交于 2020-01-22 06:54:46
问题 I found a similar question about getting just the rotation, but as I understand scaling and rotating work different in the transform matrix. Matrixes are not my strength, so if anybody would hint me how to get only the scaling out of a CGAffineTransform I'd greatly appreciate. btw. I tried applying the CGAffineTransform on a CGSize and then get the height x width to see how much it scaled, but height x width have strange values (depending on the rotation found in the CGAffineTransform, so ...

Get just the scaling transformation out of CGAffineTransform

本小妞迷上赌 提交于 2020-01-22 06:53:05
问题 I found a similar question about getting just the rotation, but as I understand scaling and rotating work different in the transform matrix. Matrixes are not my strength, so if anybody would hint me how to get only the scaling out of a CGAffineTransform I'd greatly appreciate. btw. I tried applying the CGAffineTransform on a CGSize and then get the height x width to see how much it scaled, but height x width have strange values (depending on the rotation found in the CGAffineTransform, so ...

Applying just the scale component of a CGAffineTransform to a UIView

徘徊边缘 提交于 2020-01-16 07:12:10
问题 I have a UIView to which various scale and rotation CGAffineTransforms have been applied, in response to touch screen gestures. When a scale operation completes, I want to adjust the bounds of the view to the new size, then have view to re-draw itself at a scale of 1.0, while keeping all other components of the transform the same. To adjust the bounds of the view, I'm using: self.myView.bounds = CGRectApplyAffineTransform(self.myView.bounds, self.myView.transform); To "undo" the scale

Applying just the scale component of a CGAffineTransform to a UIView

戏子无情 提交于 2020-01-16 07:11:20
问题 I have a UIView to which various scale and rotation CGAffineTransforms have been applied, in response to touch screen gestures. When a scale operation completes, I want to adjust the bounds of the view to the new size, then have view to re-draw itself at a scale of 1.0, while keeping all other components of the transform the same. To adjust the bounds of the view, I'm using: self.myView.bounds = CGRectApplyAffineTransform(self.myView.bounds, self.myView.transform); To "undo" the scale

How do I animate a UIView along a circular path?

心不动则不痛 提交于 2020-01-12 03:54:09
问题 In Swift code, how can I start and animate a UIView so that it moves in a motion along a circular path, then bring it to an end gracefully? Is it possible to achieve this using a CGAffineTransform animation? I have prepared a GIF below showing the type of animation I'm trying to achieve. 回答1: Updated: Update code to Swift 4. Use #keyPath rather than string literal for keyPath . Use UIBezierPath and CAKeyFrameAnimation . Here is the code: let circlePath = UIBezierPath(arcCenter: view.center,

Forcing UIAlertView into landscape mode

你。 提交于 2020-01-11 04:13:05
问题 I need to display a UIAlertView in landscape mode. I tried the obvious, setting the transform in the willPresentAlertView: delegate method to no avail: -(void) willPresentAlertView:(UIAlertView *)alertView { alertView.transform = CGAffineTransformMakeRotation(M_PI_2); } Any suggestions on how to fix this? 回答1: Have you tried in the didPresentAlertView ? - (void)didPresentAlertView:(UIAlertView *)alertView { // UIAlertView in landscape mode [UIView beginAnimations:@"" context:nil]; [UIView

Check if CGRect is contained within another (transformed) rect

一曲冷凌霜 提交于 2020-01-03 04:32:51
问题 I'm implementing a cropping feature and I'm trying to figure out how to test whether the crop rectangle is fully contained within the transformed image view. i.e. there should be no whitespace in the cropped portion of the image. I've tried to copy the behavior as implemented in this component: https://github.com/heitorfr/ios-image-editor, which implements a similar check (see below), but I can't get it to work for my situation. - (void)checkBoundsWithTransform:(CGAffineTransform)transform {

Keep UICollectionViewCell centered after Zooming with UIPinchGestureRecognizer

痞子三分冷 提交于 2020-01-03 02:51:05
问题 I'm having this issue. I change the scale and as well the transition of the view of a UICollectionViewCell , for doing zoom in the position of my fingers do the UIPinchGesture. But after that, the position of the view changes and the view go off the screen and its bounds. I want that the Gesture View get back to its correct position. This is what is happening: I have tried to assign a CGAffineTransformIdentity to the view if the center of the cell changes, but after the Scale and the

Change UIImageView image half way of a flip animation

情到浓时终转凉″ 提交于 2020-01-01 03:31:07
问题 How can I change the image of a UIImageView on half way of a Flip animation. My code does seem to flip the UIImageView and successfully change the image but it is changing in an instant. What I want to achieve is to only change the image once the 180 flip reaches the 90 degree flip. Here is my code: Create UIImageView on view: UIImage *image = [UIImage imageNamed:@"fb1.jpg"]; imageView = [[UIImageView alloc] initWithImage:image]; vw = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 80, 80)];

Animation of CGAffineTransform in iOS8 looks different than in iOS7

流过昼夜 提交于 2019-12-31 10:33:30
问题 I'm trying to find a reason why animation of UIView transform property looks different in iOS 8 than iOS 6/7. For a simple example, prior to iOS 8: myView.transform = CGAffineTransformRotate(CGAffineTransformIdentity, 1.57); [UIView animateWithDuration:5 animations:^{ myView.transform = CGAffineTransformTranslate(plane.transform, 100, 0); }]; gives expected result, "myView" is rotated 90 degrees and moves down, but in iOS8 when translation is animated it starts at a point that I couldn't find