Reputation: 1428
My code used to translate and scale a button used to work.
Somehow Xcode now throws a warning: Implicit declaration of function 'CGAffineTransformMakeScale' is invalid in C99.
as well as a semantic issue: Initializing 'CGAffineTransform' (aka 'struct CGAffineTransform') with an expression of incompatible type 'int'
What could be wrong with the following code?
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
CGAffineTransform scaleTrans = CGAffineTransformMakeScale(1.0f, 1.0f);//This is where both, the warning and error occur.
CGAffineTransform xTrans = CGAffineTransformMakeTranslation(650.0f,0.0f);
Button.transform = CGAffineTransformConcat(scaleTrans, xTrans);//combine translation & scale
Upvotes: 0
Views: 413
Reputation: 4093
The problem is that the compiler can't find where CGAffineTransformMake
is declared so it thinks that you are creating a new function in the middle of a method (which isn't allowed). Further because it can't find the definition of CGAffineTransformMakeScale
it assumes that it returns an int
, not a CGAffineTransform
. The problem may be that you either don't have the QuartzCore
framework linked to your project, or you're not importing <QuartzCore/QuartzCore.h>
in the file that is using CAAffineTransformMake
.
Upvotes: 1