cgaffinetransform

Convert coordinates between parent/child UIView after CGAffineTransform

空扰寡人 提交于 2019-12-20 09:28:16
问题 Before I go into doing everything by hand I would like to ask if there is some help to get from the framework. I have a UIView that holds another UIView with a map. The parent UIView holds some legends for the map. Initially I define some coordinates in the map view. e.g. (100, 40), and place a piece of graphics there in the parent view (like a tack in google maps etc.). The parent view and the child view are both 300x200 and have the same origin. This means that (100, 40) is the same point

How to resize the UIView when CGAffineTransformIdentity

ⅰ亾dé卋堺 提交于 2019-12-20 05:41:52
问题 I am doing an app which has a feature to rotate and re size a view. i have implemented this feature but i do face an issue. My problem The View wil be resized when dragging its four corners, after resizing it i can rotate the view in both directions. Once the rotation is done, if i try again to resize the view by dragging its corner, the view's size gone to unpredictable value and its moving all around the screen. I googled lot finally i got the following solution The frame property is

UIView not resizing when rotated with a CGAffineTransform under iOS8

不打扰是莪最后的温柔 提交于 2019-12-18 12:08:53
问题 I have a UIViewController that only rotates some of it subviews when the device is rotated. This works fine under iOS7 but breaks under iOS8. It appears that the UIView's bounds are adjusted by the transform under iOS8. This was unexpected. Here's some code: @interface VVViewController () @property (weak, nonatomic) IBOutlet UIView *pinnedControls; @property (nonatomic, strong) NSMutableArray *pinnedViews; @end @implementation VVViewController - (void)viewDidLoad { [super viewDidLoad]; self

How to replicate the Scale Up Animation when an app starts regularly (push app icon on HomeScreen) on an iPhone

戏子无情 提交于 2019-12-18 11:43:19
问题 i want to replicate the animation when an app starts on iPhone. There is the first view scaling up from 50 % to 100% i think. later I want to use this as a transition between 2 views. Any ideas how to replicate, or is there a ready to use solution from apple in the sdk? Thank you very much :) 回答1: You can do the same thing with CABasicAnimation and CAAnimationGroup, I actually thought that Core Animation over UIKit Animations was smoother and It gives you more control. CAAnimationGroup

(Scale) Zoom into a UIView at a point

雨燕双飞 提交于 2019-12-18 10:16:26
问题 Something I don't understand about transformations. I want to zoom in to say the top right corner of a UIView (the main view). I use CGAffineTransformScale and have tried both setting the center/anchorPoint as well as CGAffineTransformMakeTranslation to no avail. I can't figure out how to set the translation properly so that it will zoom in on this point. CGAffineTransform tr = CGAffineTransformScale(self.view.transform, 2, 2); [UIView animateWithDuration:2.5 delay:0 options:0 animations:^{

Weird behavior of UIView frame after rotation in iPhone

寵の児 提交于 2019-12-18 02:16:06
问题 Create a square UIView object testView_, and add this at viewDidLoad: - (void)viewDidLoad { [super viewDidLoad]; CGRect initialRect = testView_.frame; NSLog(@"before rotation: w %f h %f x %f y %f", initialRect.size.width, initialRect.size.height, initialRect.origin.x, initialRect.origin.y); testView_.transform = CGAffineTransformMakeRotation(0.1); NSLog(@"after rotation: w %f, h %f, x %f, y %f", testView_.frame.size.width, testView_.frame.size.height, testView_.frame.origin.x, testView_.frame

iPhone Curl Left and Curl Right transitions

六月ゝ 毕业季﹏ 提交于 2019-12-17 08:53:39
问题 I am looking for a way to do a UIViewAnimationTransitionCurlUp or UIViewAnimationTransitionCurlDown transition on the iPhone but instead of top to bottom, do it from the left to right (or top/bottom in landscape mode). I've seen this asked aroud the internet a few times but none sems to get an answer. However I feel this is doable. I have tried changing the View's transform and the view.layer's transform but that didn't affect the transition. Since the transition changes when the device

How to apply multiple transforms in Swift

a 夏天 提交于 2019-12-17 08:18:12
问题 I would like to apply multiple transforms to a UIView (or subclass of UIView ), such as translate, rotate, and scale. I know that two transforms can be applied with CGAffineTransformConcat, but how do I do it if I have three or more transforms? I have seen these questions: Applying multiple transforms to a UIView / CALayer Using Multiple CGAffineTransforms On Text Matrix but these questions are asking something different, and the given answers just talk about applying two transforms with

One step affine transform for rotation around a point?

旧街凉风 提交于 2019-12-17 04:25:11
问题 How can I make a Core Graphics affine transform for rotation around a point x,y of angle a, using only a single call to CGAffineTransformMake() plus math.h trig functions such as sin(), cos(), etc., and no other CG calls. Other answers here seem to be about using multiple stacked transforms or multi-step transforms to move, rotate and move, using multiple Core Graphics calls. Those answers do not meet my specific requirements. 回答1: A rotation of angle a around the point (x,y) corresponds to

How can I rotate and move a UIView at the same time?

心已入冬 提交于 2019-12-13 05:24:08
问题 I'm trying to make a UIView move and rotate at the same time. Here's my code: _viewToDrag.frame = CGRectMake(x, y, size, width); _viewToDrag.transform = CGAffineTransformMakeRotation(-M_PI_2 * multiplier)); As the multiplier increases (0.0 .. 1.0) the view stretches beyond any logic. This post seems to answer my question: Rotating and Moving a UIImageView (CocoaTouch) But, since I'm code-dyslexic and a bit retarded can some explain what this translates to code: Change the "center" property