Questions tagged [cgaffinetransform]

The CGAffineTransform represents a matrix used for affine transformations. A transformation specifies how points in one coordinate system map to points in another coordinate system. An affine transformation is a special type of mapping that preserves parallel lines in a path but does not necessarily preserve lengths or angles. Scaling, rotation, and translation are the most commonly used manipulations supported by affine transforms.

cgaffinetransform
Filter by
Sorted by
Tagged with
1 vote
1 answer
1k views

iOS: Rotating a line with respect to a point that could be adjusted by touch

Man, have I been struggling with this... In reference to the image above, I have a line that is fixed to a specific point. At the other end of the line I have another point that is NOT fixed and ...
1 vote
2 answers
182 views

How to rotate button back to horizontal?

I'm making a circle with different buttons all over, spaced out at equal intervals. Here's what it looks like : I want to make it so that the picture doesn't rotate. How do I achieve that ? Here's ...
2 votes
0 answers
112 views

CGAffineTransform - Compensate for an upper left transform rotate

I need to apply a translation transformation to compensate for a rectangular view being rotated around (0,0), where the original origin of the view is also 0,0. The end result should make it appear ...
1 vote
0 answers
374 views

UIView after rotate change the coordinate

When rotate the View self.myView.transform = CGAffineTransformMakeRotation(M_PI*40/100); How i get the coordinate after the myView is rotate? Is that possible view can change coordinate after ...
0 votes
1 answer
339 views

CGaffinetransform reset when UIGestureRecognizerStateFailed

I am following a tutorial to make a rotation control. Currently I added image.transform = CGAffineTransformIdentity; so that the image resets and rotates to the original state when the gesture ended ...
0 votes
1 answer
60 views

Transformation is moving all my images to the beginning

I have a View with 4 uiimages inside, 1 of them is static, but the other 3 can move, change size and flip horizontal, I can move the images as I want, but the problem is that when I want to change ...
1 vote
1 answer
230 views

What is wrong with this way of using CGAffineTransform?

I want to make a graph in a UIView that shows numerical data. So I need to draw axis, a few coordinate lines, some tick marks, and then the data as connected straight lines. The data might typically ...
0 votes
2 answers
129 views

UIView transform work strange

I use this code to move my view [UIView animateWithDuration:0.3 animations:^{ [MyView setTransform:CGAffineTransformMakeTranslation(260, 0)]; } completion:^(BOOL finished) { }]; MyView is a ...
2 votes
0 answers
512 views

AVFoundation video orientation horizontal fix does not complete full 180deg rotate

I’m working on a video orientation fix, we are joining several video tracks, each with different orientation (landscape, landscape down, landscape mirrored, landscape down mirrored). The issues I’m ...
5 votes
2 answers
3k views

Rotate UIImageView with same center point using CGAffineTransformMakeRotation

I'm trying to rotate a UIImageView and keep it centered. In the image below I would like the rotated arrow (red crosshairs) center point to match up with the center point of the 0° arrow (blue ...
0 votes
1 answer
94 views

How to detect what is the current self.view position

I've made an app (game) where randomly the view rotates from portrait to upsideDownPortrait using a NSTimer. All works fine using the code below. When this section of the game ends, I need to ...
0 votes
2 answers
4k views

I do not understand why/how CGAffineTransformTranslate works

I am creating a view and having it move on to the screen from left to right. I had a hard time getting it to work the way I wanted but when I did I was baffled at the way it worked. I thought I would ...
0 votes
1 answer
301 views

UIButton position issue on CGAffineTransformScale of parent view

I have a UIView that I scale, pan and rotate with a UIButton added to it as subview at (0,0) with width and height of 50px. This button acts as a trigger for an editing functionality. The problem I'm ...
22 votes
4 answers
67k views

iOS translation and scale animation

I'm working on UIButton animation where: The UIButton is set in the bottom center of the screen and scaled to a small size _menuBtn.transform = CGAffineTransformMakeScale(0.1f, 0.1f); When the app ...
1 vote
1 answer
176 views

Rotated Table View is not visible in iOS 6.0

In my application, I rotated the table view using CGAffineTransform rotateTable = CGAffineTransformMakeRotation(-M_PI_2); tableView.transform = rotateTable; [tableView setFrame:CGRectMake(40, 333, ...
0 votes
1 answer
38 views

CGAffineTrasformRotation also rotates the coordinating system

I am rotating a UIView and then adding a new UIView to it. But it looks really weird. Here is how it looks. The red box is the thing thats not as I expected. I want the red box to be in the same ...
1 vote
1 answer
973 views

CGAffineTransformMakeRotation again won't work

I create a UIView and set it's layer's contents a image. And I added a tap gesture to this view. When I tap the view, I want it to rotate 180 degree, and when I click close button, I want it to rotate ...
1 vote
1 answer
504 views

Scaling custom UIView by CGAffineTransformMakeScale breaks dragging with touchesMoved

I have prepared and checked into GitHub a simple test case for dragging custom UIView: It works well and dragging is implemented in the Tile.m as: - (void) touchesMoved:(NSSet*)touches withEvent:(...
2 votes
1 answer
1k views

UIPinchGestureRecognizer inwards pinch "slower"

I'm using UIPinchGestureRecognizer in my app to zoom in on a view (and yes, there's a reason I'm not using UIScrollView). When I pinch outwards with my fingers, the view zooms in as expected, and if I ...
1 vote
0 answers
312 views

Rotate keyboard 90 degree in ios using CGAffineTransform

This is my code, [[UIApplication sharedApplication] setStatusBarHidden:YES]; [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft; CGAffineTransform ...
-1 votes
1 answer
1k views

CGAffineTransformRotate on an UIImageView loads from Center

The App is in landscape mode and I have a UIButton, tapping which will attach UIImageView to the AppDelegate's window (for 'x' reasons). I tried applying the transform as shown in the code below, but ...
0 votes
0 answers
358 views

Simultaneously apply CGAffineTransforms to Translate and Scale?

I’m trying to simultaneously make a UILabel larger, and move it off-screen, to create a zoom effect. I’m trying to use the following code to do so, but I’m noticing that I can’t get both of the ...
0 votes
1 answer
1k views

Objective-c Control Transform Rotation

I have an image grid that I am zooming in and zooming out on click of the image. All is working fine, but I am having trouble controlling the rotation of the CGAffineTransform. I thought I could ...
3 votes
2 answers
2k views

CGAffineTransformScale doesn't reset

I use this code at viewDidLoad to scale my UIImageView: imageView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 3.0, 3.0); Now, I want to go back to its original size, 1.0 I use ...
0 votes
1 answer
3k views

How to create CGAffineTransform from CGAffineTransformMake?

I went through apple documentation for CGAffineTransform. But I couldn't able to figure out what are the values need to be passed to CGAffineTransformMake method to create CGAffineTransform. There ...
1 vote
1 answer
600 views

CGAffineTransformScale issues with image quality

I have a view that is being scaled down via a UIPinchGesture. A subview of that view is a UIImageView with an associate image. The issue is that the scale down seems to affect the quality of the image ...
1 vote
2 answers
423 views

drawInRect does not read / preserve UIImageView transform

I encountered a problem when I pinch, pan or rotate a UIImageview in drawInRect, the transform is not being preserved. How can I preserve the transform in drawInRect? I tried this but no go :( - (...
0 votes
1 answer
373 views

Draw image from subview into superview

I apologise in advance, this is a difficult problem to explain. Essentially I'm trying to do the equivalent of Merge Layers in Photoshop where the background image is merged with all other images, and ...
0 votes
1 answer
253 views

Setting view.layer.anchorpoint after setting view.frame makes a view blink

[self setTransform:CGAffineTransformIdentity]; [self setFrame:CGRectMake(o.x, o.y, width, self.frame.size.height)]; if(width != 0) { self.layer.anchorPoint=CGPointMake((wsCollectionView_CellSize/2)/...
3 votes
1 answer
6k views

Apply a transform in CGContextRef for drawInRect

In the code below I'm adding a small image to a large image. I need to be able to apply a transform to the small image. Right now something weird is going on, for example if I pass in a transform of ...
0 votes
1 answer
67 views

Force application rotation even locked

I have to develop an app that can rotate even if the device locker is on. That's pretty simple to retrieve the current orientation from device (using CoreMotion or [[UIDevice currentDevice]....
3 votes
1 answer
6k views

How can I use an CGAffineTransform scale and flip simultaneously

I'm trying to convert an array of points using a CGAffineTransform. The scaling works perfectly, however the points are using the top left as (0,0) not the bottom left. like so... Normally I would ...
1 vote
1 answer
451 views

uislder vertical in ios7-bar issue

i want to make my UISlider Vertical.I am using Slider in IB and the below code for changing it in to vertical. CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI * 0.5); slider.transform = ...
0 votes
1 answer
739 views

iOS scaling with CGAffineTransformMakeScale on drawRect content

float scaleFactor = 0.5; self.bubble.transform = CGAffineTransformMakeScale(scaleFactor, scaleFactor); [self.bubble setNeedsDisplay]; [UIView animateWithDuration:2.0 animations:^{ ...
0 votes
1 answer
159 views

iOS - get center of object that's been scaled

I scaled my view using CGAffineTransformMakeScale and I need to find the center of it. The x scale factor == the y scale factor but the factor will change in a UIView animation [UIView ...
0 votes
0 answers
150 views

iOS - Changing transform invalidates changes in center

Lets say I have a view A as a subview of view B, when I change the transform and center property of the view A, the center value is ignored. Here is my code, I subclassed a UIView: - (void)...
0 votes
1 answer
665 views

Calculate rotation angle for anchor point

I got stuck with a problem where I need to reposition views to predefined locations. All views have a UIPanGestureRecognizer and a UIRotationGestureRecognizer and are positioned/rotated inside the ...
0 votes
1 answer
195 views

Spin and move UIView

How to move continuously spinning UIView with animation blocks? Eg., I have this code for spinning: - (void)spinView:(UIView *)view { [UIView animateWithDuration:0.2f ...
5 votes
4 answers
4k views

Animation, like when you delete from iPhone Photo Gallery

I try to implement the animation: when you enter iPhone Gallery, press the image, you see full-screen image. Below you can see toolbar with trash button. When you press this button, the image is being ...
8 votes
2 answers
12k views

iOS: Simultaneous scale and 3D rotation animation

I made a video demonstrating the animation i'm trying to accomplish: Here it is. Notice the video illustrates the action as it would be seen from the side. The camera icon represents the user's POV. ...
0 votes
1 answer
2k views

how to rotate NSString drawinrect in CGContext

how do i rotate a NSString to a certain degree ? when i draw a string together with an image. i referred this SO question Drawing rotated text with NSString drawInRect but my Ellipse is gone. //Add ...
0 votes
1 answer
401 views

CGAffineTransformScale not scaling a gesture area

I have a 3x3 grid of UIViews with UIGestureRecognizers added to them, arranged like so: The way it works is that tapping on a square enlarges it 2x using CGAffineTransformScale and overlays that over ...
3 votes
1 answer
3k views

AVMutableVideoCompositionInstruction is ignored in a AVMutableVideoComposition

When I create a video using this tutorial and I try to move the AVAssetTrack* firstTrack (without animation, so I cannot use CAAnimations) using AVMutableVideoCompositionInstruction with a ...
1 vote
1 answer
2k views

UIImage transform/scaling issues

Finally, I have a reason to ask something, instead of scouring endless hours of the joys of Stack Overflow. Here's my situation: I have an UIImageView with one UIImage inside it. I'm transforming the ...
0 votes
1 answer
413 views

Moving image in certain area by touch using CGAffineTransformTranslate

I want to move the image in the certain area of screen. I don't want to mess with frame, because it causes trouble with collision behavior later on. I got this code so far.I don't know how to use ...
1 vote
3 answers
2k views

Rotating UIImageView more than 180 degrees using animations on iOS

Im trying to animate a moving meter by rotating it more than 180 degrees, but it wont work. Im using CGAffineTransform to rotate the meter, which uses a net result to make the rotation. This means ...
0 votes
1 answer
165 views

How to move UIImageView in order to always keep image's head forward?

Assume I have an UIImageView in ViewController's view, and this UIImageView contains an image. As an example, let it be a car image with the car's head directing towards north by default. I want to ...
1 vote
1 answer
555 views

UIView scaling transform causing inputs to get lost

I am trying to display a 3rd party UIView, which basically contains an image with some clickable (touchable) regions. For example, it contains a region, that when clicked, launches a web page. I ...
1 vote
1 answer
661 views

Rotate imageView as per touch

I am rotating imageView which is minuit hand of a clock, with -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; if ([touch view] == ...
-1 votes
2 answers
154 views

How to maintain the transformations made to a UIview

I have a view, inside that view I have an UIImageview but inside this UIImageview I have 3 more UIImageview, this 3 UIImageview I can drag them and resize them, the problem is that when i resize one ...

1
9 10
11
12 13
17